












































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Aimed at individuals focusing on the design and structure of web pages using HTML, this exam covers basic to advanced HTML elements, document structure, accessibility standards, and best practices for semantic HTML coding.
Typology: Exams
1 / 84
This page cannot be seen from the preview
Don't miss anything!













































































Question 1. Which HTML tag defines the document type declaration for HTML5? A) B) C) D) Answer: B Explanation: is the required declaration that tells browsers the document follows the HTML5 specification. **Question 2.** What is the primary purpose of the tag in the section? A) Define the page language B) Link an external stylesheet C) Set the character encoding to UTF‑ 8 D) Provide a description for search engines Answer: C Explanation: The `charset` attribute specifies the character encoding, ensuring that characters display correctly across browsers. **Question 3.** Which element is *block‑level* by default? A) B) C) D) Answer: C Explanation: is a semantic block‑level element that starts on a new line and takes the full width.
Question 4. Which attribute is used to specify the primary language of an HTML document? A) lang on B) `xml:lang` on C) locale on D) `direction` on Answer: A Explanation: The lang attribute on the tag declares the document’s language for accessibility and SEO. **Question 5.** Which of the following values correctly references an external stylesheet? A) B) C) D) Answer: B Explanation: rel="stylesheet" tells the browser that the linked resource is a CSS stylesheet. Question 6. To improve page load performance, which attribute can be added to a Answer: A Explanation:inserts a line break within the flow of text. **Question 10.** Which pair of tags correctly represents emphasized text that should be read with strong importance? A)B)C)D) `` Answer: A Explanation:` indicates strong importance, while signals emphasis; nesting them is valid. **Question 11.** Which semantic element should be used to contain navigation links? A) B) C) D) Answer: A Explanation: explicitly represents a block of major navigation links. Question 12. In a properly structured HTML5 page, how many `` elements should typically appear? A) Zero B) One C) Two D) As many as needed for sections
Answer: B Explanation: A single defines the main heading, improving SEO and accessibility hierarchy. **Question 13.** Which element is best suited for content that is tangentially related to the main article? A) B) C) D) Answer: B Explanation: holds secondary content such as sidebars, pull quotes, or related links. Question 14. Which HTML tag creates a definition list? A) B) C) D) Answer: A Explanation: contains (term) and (definition) pairs. **Question 15.** Which attribute on helps screen readers understand the relationship between header and data cells? A) colspan B) rowspan C) scope D) abbr
Answer: B Explanation: Absolute URLs include scheme, host, and path, while relative URLs resolve against the current page’s location. Question 19. Which combination of attributes helps prevent the newly opened tab from accessing the original page’s `window.opener` property? A) `target="_blank" rel="noopener"` B) `target="_self" rel="noopener"` C) `target="_blank" rel="noreferrer"` D) `target="_top" rel="external"` Answer: A Explanation: `rel="noopener"` stops the new page from gaining a reference to the originating window, improving security. **Question 20.** Which HTML element is used to define an image map? A) B) C) D) Answer: A Explanation: contains one or more `` elements that define clickable regions on an image. Question 21. In an HTML form, which method should be used when sending sensitive data such as passwords? A) GET B) POST
Answer: B Explanation: POST sends data in the request body, not in the URL, making it more suitable for confidential information. Question 22. Which attribute groups related form controls together, providing a visual border and a caption? A) B) with C) D) Answer: B Explanation: creates a logical grouping, and `` supplies a caption for the group. Question 23. Which input type is most appropriate for collecting a user’s birth date? A) type="text" B) type="datetime" C) type="date" D) type="number" Answer: C Explanation: type="date" provides a date picker UI and validates the format automatically. Question 24. When creating a set of mutually exclusive options, which attribute must be identical across the radio buttons? A) id
C) format D) validate Answer: A Explanation: pattern defines a JavaScript‑compatible regular expression for validation. Question 28. Which attribute improves usability by placing the cursor in a text field when the page loads? A) autofocus B) autofill C) focus D) selected Answer: A Explanation: autofocus automatically focuses the element on page load. Question 29. Which HTML element should be used to embed a video with fallback sources? A) B) with children C) D) Answer: B Explanation: can contain multiple elements, allowing the browser to choose a supported format. **Question 30.** Which attribute on the tag enables the user to control playback (play, pause, volume)? A) autoplay
B) controls C) muted D) loop Answer: B Explanation: Adding controls displays the native UI for audio playback. Question 31. To provide subtitles for a video, which element is used inside ? A) B) C) D) Answer: B Explanation: with kind="subtitles" links a WebVTT file containing subtitle text. Question 32. Which attribute on an tag tells the browser to load the image lazily? A) `defer="lazy"` B) `loading="lazy"` C) `lazy="true"` D) `async="lazy"` Answer: B Explanation: `loading="lazy"` defers off‑screen image loading until needed. **Question 33.** Which element is used to display vector graphics directly in HTML without an external file? A) B) ``
D) Robust Answer: B Explanation: Operable requires that interface components be usable via keyboard, mouse, or assistive technology. Question 37. Which ARIA attribute provides an accessible name for an element that lacks visible text? A) aria-label B) role C) aria-describedby D) title Answer: A Explanation: aria-label supplies a text alternative read by screen readers. Question 38. According to best practices, when should you use ARIA over native HTML elements? A) Never; ARIA is deprecated. B) Only when native elements cannot convey the required semantics. C) For all interactive elements to improve accessibility. D) When you want to add styling hooks for CSS. Answer: B Explanation: ARIA should supplement, not replace, native semantics; use it only when no appropriate HTML element exists. Question 39. Which HTML comment syntax is correct? A) `` B) /* This is a comment */
C) // This is a comment D) # This is a comment Answer: A Explanation: HTML comments are enclosed within . **Question 40.** What does the W3C validator primarily check for? A) Browser compatibility B) Compliance with HTML specifications C) Page load speed D) SEO ranking Answer: B Explanation: The validator verifies that the markup follows the formal HTML standards. **Question 41.** Which attribute is **invalid** on the tag? A) bgcolor B) class C) id D) style Answer: A Explanation: bgcolor is a presentational attribute deprecated in HTML5; modern code should use CSS. Question 42. Which selector targets an element with the id main-header? A) .main-header B) #main-header C) header.main-header
Answer: B Explanation: Classes can be applied to multiple elements, whereas IDs must be unique. Question 46. Which attribute on a element tells browsers that the linked resource is a favicon? A) `rel="icon"` B) `type="image/x-icon"` C) `href="favicon.ico"` D) `media="all"` Answer: A Explanation: `rel="icon"` designates the link as a site icon. **Question 47.** Which HTML element is used to provide a short citation or reference for a quote? A) B) C) D) Answer: A Explanation: indicates the source of a quotation or reference. Question 48. Which attribute on `` controls the viewport for responsive design on mobile devices? A) name="viewport" B) http-equiv="viewport" C) content="width=device-width, initial-scale=1" D) Both A and C together
Answer: D Explanation: The correct viewport meta tag is . **Question 49.** Which element should be used to group a series of related form controls that share a common purpose, such as address fields? A) B) C) D) Answer: B Explanation: semantically groups related controls, improving accessibility. Question 50. Which attribute on allows multiple files to be selected? A) `multiple` B) `many` C) `list` D) `multi-select` Answer: A Explanation: The `multiple` attribute enables selection of more than one file. **Question 51.** Which HTML5 element is best suited for a self‑contained blog post that could be syndicated? A) B) C) D) ``
Explanation: type="video/mp4" tells the browser the format of the source file. Question 55. Which attribute on specifies where to send the form data when submitted? A) `action` B) `method` C) `target` D) `enctype` Answer: A Explanation: `action` defines the URL that will process the submitted data. **Question 56.** Which attribute on determines how the form data is encoded? A) method B) enctype C) action D) autocomplete Answer: B Explanation: enctype="multipart/form-data" is required for file uploads; other values include application/x-www-form-urlencoded. Question 57. Which attribute on `` limits the maximum number of characters a user can enter? A) maxlength B) max C) limit D) size Answer: A
Explanation: maxlength restricts the character count. Question 58. Which attribute on defines the step interval between selectable values? A) `step` B) `increment` C) `interval` D) `gap` Answer: A Explanation: `step="5"` would allow increments of five units. **Question 59.** Which HTML element can be used to display a short quotation that is part of a paragraph, while also providing a citation? A) with inside B) with cite attribute C) alone D) with source attribute Answer: B Explanation: marks an inline quotation and optionally supplies a source URL. **Question 60.** Which attribute on the tag is used to control the character encoding of the document? A) charset B) encoding C) http-equiv D) content-type Answer: A