Identify and correct the structural problems in this example:
<html>
<body>
<title>My Page</title>
<h1>Welcome</h1>
</body>
</html>Your corrected version should use a suitable DOCTYPE and place the title in the appropriate part of the document.
17. Section 2 Quiz
Answer these 10 questions to check your understanding. Try to solve them before revealing the answer and explanation for each question.
Question 1: What is the primary purpose of the HTML5 DOCTYPE declaration?
- To load an external stylesheet.
- To help the browser use standards mode.
- To declare the document's primary language.
- To execute JavaScript before parsing HTML.
Correct answer: B — To help the browser use standards mode.
- A is incorrect because stylesheets are commonly connected using link.
- B is correct because the HTML5 DOCTYPE helps browsers use standards-oriented rendering.
- C is incorrect because the lang attribute identifies the document language.
- D is incorrect because DOCTYPE does not execute scripts.
Question 2: Where should the title element normally be placed?
- Inside head.
- Inside body.
- Inside footer.
- Inside a paragraph element.
Correct answer: A — Inside head.
- A is correct because title is metadata content that belongs in head.
- B is incorrect because title is not intended to be placed in body.
- C is incorrect because footer is a body content element.
- D is incorrect because title cannot be nested inside a paragraph.
Question 3: Which declaration specifies UTF-8 character encoding?
<meta name="language" content="UTF-8"><meta charset="UTF-8"><title charset="UTF-8"><html charset="UTF-8">
Correct answer: B — meta charset="UTF-8".
- A does not use the standard charset declaration.
- B is correct because the charset attribute declares the document encoding.
- C is incorrect because title does not declare the document's character encoding.
- D is incorrect because charset is not used this way on the html element.
Question 4: Which two elements are normally direct children of the root html element?
- head
- body
- title
- footer
Correct answers: A and B.
- A is correct because head is normally a direct child of html.
- B is correct because body is normally a direct child of html.
- C is incorrect because title belongs inside head.
- D is incorrect because footer is normally part of body content.
Question 5: True or False — The HTML5 DOCTYPE is a normal HTML element with an opening and closing tag.
- True
- False
Correct answer: B — False.