Answer: C. Web page structure. HTML gives web content its structure and meaning.
Which element represents the main page content?
A <footer>
B <main>
C <aside>
D <title>
Answer: A. <footer>. The main element identifies the dominant content of a document.
Why use semantic HTML elements?
A Replace every CSS rule
B Encrypt page content
C Store user passwords
D Improve meaning and navigation
Answer: D. Improve meaning and navigation. Semantic elements communicate content roles to browsers and assistive technologies.
Which technology styles a web page?
A CSS
B HTTP
C DNS
D JSON
Answer: B. HTTP. CSS controls presentation such as layout, color, and typography.
What does the CSS box model include?
A Header, body, footer, script
B Content, padding, border, margin
C Host, path, query, fragment
D Request, response, status, header
Answer: B. Content, padding, border, margin. The CSS box model describes content, padding, border, and margin.
How does a class selector target elements?
A By matching page titles
B By matching server ports
C By matching file sizes
D By matching class names
Answer: D. By matching class names. A CSS class selector matches elements whose class attribute includes that name.
What is a media query commonly used for?
A Applying styles by conditions
B Sending data to servers
C Creating database tables
D Encrypting browser cookies
Answer: A. Applying styles by conditions. Media queries apply styles when conditions such as viewport width are met.
Which CSS layout tool arranges items along axes?
A DNS
B JSON
C Flexbox
D TLS
Answer: C. Flexbox. Flexbox is designed to lay out items along a row or column.
When is CSS Grid especially useful?
A For resolving domain names
B For encrypting network traffic
C For parsing JSON
D For two-dimensional layouts
Answer: D. For two-dimensional layouts. Grid supports layout across rows and columns.
What does JavaScript commonly add to web pages?
A Domain registration
B Interactive behavior
C Physical storage
D Screen hardware
Answer: B. Interactive behavior. JavaScript can respond to events and update page behavior.
How can a script respond to a button click?
A Change the DNS record
B Open a database port
C Register an event listener
D Edit the image pixels
Answer: C. Register an event listener. An event listener runs code when the specified event occurs.
What does DOM represent in browser scripting?
A Document Object Model
B Data Output Method
C Domain Order Map
D Device Operating Mode
Answer: A. Document Object Model. The DOM represents a document as objects that scripts can inspect and modify.
Which format represents structured data as text?
A JSON
B JPEG
C MP3
D PNG
Answer: A. JSON. JSON is a text format for representing structured data.
How does the Fetch API commonly obtain web resources?
A It styles page headings
B It resizes image files
C It registers domain names
D It sends network requests
Answer: D. It sends network requests. Fetch provides a JavaScript interface for making network requests.
What is HTTP used for on the web?
A Drawing page borders
B Exchanging request and response messages
C Storing passwords locally
D Compressing image pixels
Answer: B. Exchanging request and response messages. HTTP is a protocol for transferring resources through client requests and server responses.
Which HTTP method is typically used to retrieve a resource?
A POST
B PATCH
C GET
D CONNECT
Answer: C. GET. GET requests a representation of a resource.
When is POST commonly used?
A Retrieving a page title
B Submitting data for processing
C Resolving a domain name
D Styling a form field
Answer: B. Submitting data for processing. POST commonly submits data for server-side processing.
What does HTTPS add to HTTP connections?
A TLS protection in transit
B Automatic database backups
C Guaranteed user anonymity
D Permanent browser storage
Answer: A. TLS protection in transit. HTTPS uses TLS to protect communication between a client and server.
Which service maps domain names to network records?
A CSS
B DOM
C SVG
D DNS
Answer: D. DNS. DNS resolves domain names to information such as IP addresses.
Which parts are commonly found in a URL?
A Font, color, and margin
B User, group, and role
C Scheme, host, and path
D Table, row, and column
Answer: C. Scheme, host, and path. A URL can include a scheme, host, path, query, and fragment.
What can a browser cookie store?
A Small site-related data
B Entire video libraries
C Operating-system drivers
D Public DNS zones
Answer: A. Small site-related data. Cookies store small pieces of data associated with a website.
How does localStorage generally differ from sessionStorage?
A It exists only on servers
B Stores credentials automatically
C It persists across browser sessions
D It clears after every keystroke
Answer: C. It persists across browser sessions. localStorage data generally remains after a browser tab closes; sessionStorage is scoped to a page session.
What does CORS control?
A CSS color inheritance
B Image compression ratios
C Cookie expiration dates
D Cross-origin browser access
Answer: D. Cross-origin browser access. CORS is a browser security mechanism for controlling cross-origin requests.
What does an API provide to software?
A A larger display area
B A defined interaction interface
C A permanent network address
D An image file format
Answer: B. A defined interaction interface. An API defines how software components can interact.
Which payload format is common in web APIs?
A BMP
B WAV
C JSON
D TIFF
Answer: C. JSON. Many web APIs exchange structured data using JSON.
In a client-server model, what does the client do?
A Assigns public domain names
B Maintains all global standards
C Manufactures network cables
D Requests a service or resource
Answer: D. Requests a service or resource. A client initiates requests to a server for data or services.
Where does front-end code usually run?
A Only on a DNS server
B In the user’s browser
C Inside a database engine
D On a router’s firmware
Answer: B. In the user’s browser. Front-end code commonly runs in a browser and presents the user interface.
Which browser tool helps inspect network requests?
A Developer Tools Network panel
B Taskbar volume control
C File Explorer preview
D Printer settings dialog
Answer: A. Developer Tools Network panel. The Network panel shows requests, responses, timing, and related details.
Why defer off-screen image loading?
A To increase DNS records
B To disable keyboard input
C To enlarge every image
D To reduce initial page work
Answer: D. To reduce initial page work. Lazy loading can defer off-screen images and reduce initial loading work.
What can browser caching reduce?
A Repeated resource downloads
B HTML semantic structure
C User authentication checks
D Keyboard focus order
Answer: A. Repeated resource downloads. A valid cached response can avoid downloading an unchanged resource again.
How can users navigate a site without a mouse?
A Using image compression
B Using domain registration
C Using keyboard controls
D Using server logs
Answer: C. Using keyboard controls. Keyboard access lets people navigate and operate many interfaces without a mouse.
Which heading structure best supports document navigation?
A Random font-size changes
B Meaningful nested headings
C Bold paragraphs only
D Images without captions
Answer: B. Meaningful nested headings. Properly nested headings help users understand and navigate document sections.
What should useful image alternative text convey?
A Every pixel’s color value
B The image’s relevant meaning
C The server’s file directory
D The camera’s serial number
Answer: B. The image’s relevant meaning. Alternative text communicates meaningful image information to people who cannot see it.
Why associate a form label with its input?
A To compress submitted data
B To add a database index
C To hide field validation
D To identify the input clearly
Answer: D. To identify the input clearly. Labels identify form controls and improve their accessibility and usability.
Which practice improves text readability?
A Smaller text everywhere
B Color-only instructions
C Sufficient foreground contrast
D Removing visible focus
Answer: C. Sufficient foreground contrast. Adequate contrast helps users distinguish text from its background.
How can responsive images adapt to different screens?
A Serve suitable image sources
B Change the DNS provider
C Disable browser caching
D Remove image descriptions
Answer: A. Serve suitable image sources. Responsive image features let browsers select an appropriate image resource.
What is an advantage of SVG graphics?
A They require no markup
B They store relational tables
C They replace HTTP requests
D They scale without pixelation
Answer: D. They scale without pixelation. SVG graphics are vector-based and can scale to different sizes.
Where does WebAssembly run in a web application?
A Inside a CSS selector
B In a compatible web runtime
C Only in a database server
D In a domain registrar
Answer: B. In a compatible web runtime. WebAssembly is a format browsers can execute in a controlled runtime.
What can a service worker help a web app do?
A Handle selected tasks in background
B Style every HTML element
C Register a top-level domain
D Replace the browser engine
Answer: A. Handle selected tasks in background. Service workers can support capabilities such as offline behavior and background tasks.
How can developers reduce DOM-based cross-site scripting risk?
A Trust every query parameter
B Disable all HTML escaping
C Treat untrusted input safely
D Store scripts in cookies
Answer: C. Treat untrusted input safely. Unsafe handling of untrusted input can enable script injection; safe APIs and validation reduce risk.
What does a Content Security Policy help restrict?
A User screen brightness
B Domain registration fees
C Database table names
D Allowed content sources
Answer: D. Allowed content sources. CSP lets a site define which sources are allowed for certain content types.
Which attack can exploit a user’s authenticated browser session?
A Image scaling failure
B DNS cache warming
C Cross-site request forgery
D CSS selector mismatch
Answer: C. Cross-site request forgery. CSRF tricks a browser into sending an unwanted request with its existing credentials.
What does input parameterization help prevent?
A Image blurring
B SQL injection
C Color contrast loss
D URL shortening
Answer: B. SQL injection. Parameterized queries keep data separate from SQL instructions.
How do authentication and authorization differ?
A Identity versus permitted actions
B Encryption versus compression
C Styling versus scripting
D Caching versus routing
Answer: A. Identity versus permitted actions. Authentication verifies identity; authorization determines what that identity may do.
What does a content delivery network distribute?
A Database schemas to browsers
B Passwords across websites
C Content from nearby edge servers
D HTML tags to domain registrars
Answer: C. Content from nearby edge servers. A CDN serves cached content through a distributed network of edge locations.
Why use a load balancer?
A Replace every database backup
B Distribute requests across servers
C Translate CSS into HTML
D Issue browser permissions
Answer: B. Distribute requests across servers. Load balancers distribute traffic among available servers.
Which technology supports two-way web communication over one connection?
A CSS Grid
B DNSSEC
C JPEG
D WebSocket
Answer: D. WebSocket. WebSocket supports interactive bidirectional communication over a connection.
What does HTTP status code 404 indicate?
A The resource was not found
B The request succeeded
C The server is restarting
D The client is unauthorized
Answer: A. The resource was not found. A 404 response indicates that the requested resource was not found.
Why publish an XML sitemap?
A Encrypt a login form
B Compress CSS files
C Help crawlers discover URLs
D Set browser permissions
Answer: C. Help crawlers discover URLs. A sitemap lists URLs that site owners want search engines to discover.
What can structured data help search engines understand?
A The user’s private password
B Details about page content
C A server’s power supply
D The browser’s screen brightness
Answer: B. Details about page content. Structured data provides machine-readable details about the content on a page.