Written Test Document Structure 2 — Questions and Answers
Question 1: Which element is used to group multiple related form controls and labels?
- <section>
- <fieldset> (Correct answer)
- <article>
- <aside>
Correct answer: <fieldset>
The <fieldset> element groups related form controls, and a <legend> child provides a caption for the group.
Question 2: What is the correct way to specify that an HTML document uses UTF-8 character encoding?
- <charset="UTF-8">
- <encoding type="UTF-8">
- <meta charset="UTF-8"> (Correct answer)
- <meta http-equiv="charset" content="UTF-8">
Correct answer: <meta charset="UTF-8">
The shorthand <meta charset="UTF-8"> is the modern, correct way to declare UTF-8 encoding in HTML5.
Question 3: Which HTML element represents a self-contained piece of content that could be distributed independently, like a news article?
- <section>
- <div>
- <article> (Correct answer)
- <main>
Correct answer: <article>
The <article> element is for self-contained, independently distributable content such as blog posts or news stories.
Question 4: Where should the <link> element for a stylesheet be placed in an HTML document?
- At the end of the <body>
- Inside the <head> (Correct answer)
- After the <html> tag but before <head>
- Anywhere in the document
Correct answer: Inside the <head>
Stylesheet <link> elements belong inside <head> so the browser can load CSS before rendering the body.
Question 5: What does the `lang` attribute on the <html> element specify?
- The scripting language used on the page
- The natural language of the document's content (Correct answer)
- The encoding format of the document
- The translation service to use
Correct answer: The natural language of the document's content
The `lang` attribute declares the primary natural language of the document, helping screen readers and search engines.
Question 6: Which element is the most appropriate container for a website's primary navigation links?
- <header>
- <menu>
- <nav> (Correct answer)
- <ul>
Correct answer: <nav>
The <nav> element is specifically designed to wrap major navigation link blocks within a document.
Question 7: What happens if a required closing tag is omitted in an HTML document?
- The browser throws a fatal error and stops rendering
- The browser typically auto-closes the element using error recovery rules (Correct answer)
- The document becomes invalid and displays nothing
- The tag is ignored and the content is hidden
Correct answer: The browser typically auto-closes the element using error recovery rules
Browsers use built-in error recovery to auto-close many elements, though this can produce unexpected layout results.
Which element is used to group multiple related form controls and labels?