Unit 1: HTML Fundamentals - Practice Quiz
1 What is the Internet?
2 What does HTTP stand for?
3 In a client-server model, what does a client usually do?
4 What is the main role of a web server?
5 What does HTML stand for?
6 Which declaration identifies an HTML5 document?
7 Which element contains the visible content of an HTML document?
8 Which element contains metadata and links to resources?
9 What is an HTML attribute?
10 Which attribute specifies the destination of a hyperlink?
11 Which HTML element represents the most important heading?
12 Which element is commonly used to display emphasized text?
13 Which element creates an unordered list?
14 Which element defines an item in an HTML list?
15 Which element is used to add an image to a web page?
16
What is the purpose of the alt attribute on an image?
17 What does SVG stand for?
18 Which HTML element embeds audio content?
19 Which attribute displays playback controls for an HTML video?
20 What is the main purpose of SEO?
21
A user enters https://shop.example.com/products in a browser. Which technology first translates shop.example.com into an IP address?
22
A website loads its HTML successfully, but its stylesheet request returns HTTP status 404. What should the browser conclude?
23 An online store must prevent users from changing product prices before checkout. Where should the final price validation occur?
24 A browser submits a login form, and the server returns a session cookie. What is the cookie's main role in later requests?
25 Which declaration should appear at the beginning of a modern HTML5 document to request standards-mode rendering?
<!DOCTYPE HTML5>
<meta standard="html5">
<!DOCTYPE html>
<html version="5">
26 A page contains navigation links, an independent blog post, and a footer. Which set of HTML5 elements best represents these roles?
<nav>, <article>, and <footer>
<menu>, <content>, and <bottom>
<links>, <section>, and <end>
<div class="nav">, <div class="article">, and <div class="footer"> because HTML5 semantic elements should be avoided
27
A page uses <script src="app.js" defer></script> inside <head>. When is app.js executed?
DOMContentLoaded
28 Which placement correctly defines the document's character encoding for reliable interpretation by the browser?
<encoding type="UTF-8"> immediately after the closing </html> tag
<meta charset="UTF-8"> near the start of <head>
<charset value="UTF-8"> inside the root <html> element
<meta charset="UTF-8"> near the end of <body>
29
Given <button disabled="false">Save</button>, how will a conforming browser treat the button?
false to a Boolean
30 Several labels need the same CSS styling, while each label may also need a unique JavaScript identifier. Which attribute assignment is most appropriate?
style attribute as the unique identifier for each label
id and a unique class
class and a unique id
id on every label
31 A warning sentence must visually emphasize the word "Important" and also communicate its strong importance to assistive technologies. Which element is most suitable?
<b>Important</b>
<strong>Important</strong>
<span style="font-weight: bold">Important</span> with no semantic indication of importance
<mark>Important</mark>
32 An ordered list must display three steps numbered 4, 5, and 6. Which markup is appropriate?
<ol start="4"><li>A</li><li>B</li><li>C</li></ol>
<ol value="4"><li>A</li><li>B</li><li>C</li></ol>
<ul start="4"><li>A</li><li>B</li><li>C</li></ul>
<ol><li start="4">A</li><li>B</li><li>C</li></ol>
33
The current page is https://example.com/docs/guides/start.html. What URL does the relative link <a href="../api.html">API</a> resolve to?
https://example.com/docs/guides/start.html/api.html
https://example.com/docs/guides/api.html
https://example.com/api.html
https://example.com/docs/api.html
34 A company logo is also a link to the home page. Which markup gives the image an appropriate accessible name?
<a href="/"><img src="logo.png" alt="Acme home"></a>
<a href="/"><img src="logo.png" alt=""></a>
<a href="/"><img src="logo.png" title="Image"></a>
<a href="/"><img src="logo.png" aria-hidden="true"></a>
35
An inline SVG uses <svg viewBox="0 0 200 100" width="400" height="200">. A circle centered at (100, 50) is rendered where within the SVG viewport?
36 A developer needs each shape in an icon to respond independently to CSS hover rules. Which approach is most suitable?
<img> element
37
A video should provide English captions that viewers can enable. Which child element should be added inside <video>?
<meta name="captions" content="captions.vtt">
<source kind="captions" lang="en" src="captions.vtt">
<caption lang="en" src="captions.vtt">
<track kind="captions" srclang="en" src="captions.vtt">
38
An untrusted page is embedded with <iframe sandbox src="external.html"></iframe>. What is the default effect of the empty sandbox attribute?
39
An e-commerce site uses the title Products on every product page. Which revision most directly improves search-result relevance?
<h1> element
40 Two URLs serve identical article content, but one is the preferred URL for search indexing. Which element should the duplicate page include?
<link rel="stylesheet" href="preferred-url">
<meta name="duplicate" content="preferred-url">
<a rel="index" href="preferred-url">
<link rel="canonical" href="preferred-url">
41
A user navigates to https://example.com/manual.html#installation. Which statement correctly describes how the fragment identifier affects the initial page request?
#installation from the HTTP request and processes the fragment after receiving the resource.
#installation and maps it to the server hosting that section.
#installation separately before the HTTP request is transmitted.
#installation in the HTTP request target so the server can return that section.
42
A browser has a cached representation with an ETag and sends If-None-Match. The server replies with 304 Not Modified and updated cache headers. What should the browser do?
304 response contains no representation.
304 response.
If-None-Match before displaying any content.
43
Two tabs from the same browser profile open the same origin. Authentication uses a normal session cookie, while temporary UI state uses sessionStorage. Which behavior should generally be expected?
sessionStorage.
sessionStorage.
localStorage.
44
A modern page begins directly with <html> and omits <!doctype html>. Its elements otherwise use valid HTML5 syntax. What is the most important consequence?
45
The document URL is https://example.test/docs/page.html and its <head> contains <base href="/assets/v2/">. To which absolute URL does <a href="#api">API</a> resolve?
https://example.test/docs/#api
https://example.test/assets/v2/#api
https://example.test/assets/v2/page.html#api
https://example.test/docs/page.html#api
46
A server sends an HTML document without an HTTP charset parameter. The document contains <meta charset="utf-8">, but that declaration begins after the first 1024 bytes. Which assessment is correct?
<head> element.
47
Consider <button disabled="false">A</button> and <button disabled="0">B</button>. Assuming no script changes their states, which result follows HTML boolean-attribute rules?
48
An input appears outside a form: <input name="coupon" value="SAVE" form="checkout">. Later, the page contains <form id="checkout"><button>Pay</button></form>. What happens when the form is submitted normally?
form attribute associates it with checkout.
form attribute works only on submit buttons.
49
Which mapping most accurately reflects the semantic purpose of the HTML elements <strong>, <em>, <b>, and <i>?
<strong> makes text larger, <em> makes text smaller, <b> marks importance, and <i> marks stress.
<strong> marks urgency, <em> marks citations, <b> marks definitions, and <i> marks keyboard input.
<strong> marks stress, <em> marks importance, <b> marks quotations, and <i> marks deleted text.
<strong> marks importance, <em> marks stress, <b> draws attention, and <i> marks alternate voice.
50
What marker values are generated by <ol reversed start="10"><li>A</li><li value="4">B</li><li>C</li></ol>?
51
For <a href="https://external.test" target="_blank" rel="noreferrer">Open</a>, which behavior is specifically requested by noreferrer?
52
An image has srcset="600.jpg 600w, 1200.jpg 1200w, 1800.jpg 1800w" and sizes="(max-width: 600px) 100vw, 50vw". At a 1200 CSS-pixel viewport and device-pixel ratio 2, which candidate is the nominal best match, ignoring cache and network heuristics?
600.jpg, because sizes is evaluated independently of pixel density.
600.jpg, because the image occupies 600 CSS pixels.
1800.jpg, because the viewport width is multiplied by the density.
1200.jpg, because the 600-pixel slot is rendered at 2x density.
53
A 1000-pixel-wide viewport loads the following markup. The browser supports WebP but not AVIF. Which resource is selected?
<picture><source media="(min-width: 900px)" type="image/avif" srcset="wide.avif"><source type="image/webp" srcset="photo.webp"><img src="photo.jpg" alt="Product"></picture>
photo.jpg, because <source> elements apply only below their media breakpoint.
photo.jpg, because an unsupported first <source> forces the <img> fallback.
photo.webp, because the AVIF source is unsupported and the WebP source is usable.
wide.avif, because its media query is the first one that matches.
54
An SVG has width="400", height="200", and viewBox="0 0 100 100" with the default preserveAspectRatio. How is the square viewBox mapped into the viewport?
55
An SVG path contains two concentric closed subpaths drawn in the same direction. How do fill-rule="nonzero" and fill-rule="evenodd" typically differ for the inner region?
nonzero fills the inner region, while evenodd treats it as a hole.
nonzero creates a hole, while evenodd fills the inner region.
56
A modern browser supports the <video> element, but none of the supplied <source> formats can be decoded. What happens to a paragraph placed as fallback content inside <video>?
<video> support.
<source> has an explicit invalid type.
57
Client-side code executes const result = video.play(); on an unmuted video without a user gesture. What is the robust way to handle modern browser autoplay policies?
result as a promise and handle rejection, such as a NotAllowedError.
result as a boolean and retry immediately whenever it equals false.
play() overrides declarative autoplay rules.
loadedmetadata, after which play() cannot be blocked by policy.
58
A same-origin page is embedded using <iframe sandbox="allow-scripts" src="/tool.html"></iframe>. Which statement best describes the embedded page?
allow-same-origin is required before allow-scripts works.
postMessage().
59
Several URLs expose substantially identical content and each duplicate contains <link rel="canonical" href="https://example.com/preferred">. What does the canonical link do?
60
A developer writes <button type="button"><a href="/checkout">Checkout</a></button> to obtain button styling and navigation. What is the best correction?
role="link" to the outer button for clearer semantics.
<a href="/checkout"> and style it appropriately for the navigation action.
type attribute to normalize activation.
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill. The rest comes out of a student's own pocket: the domain, the storage, and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason. to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it. What it pays for →