- True is incorrect because DOCTYPE is a declaration, not an HTML element.
- False is correct because
<!DOCTYPE html>is written as a standalone declaration.
Question 6: What is the DOM?
- A database that stores every website's HTML.
- A CSS file generated by the browser.
- A structured document representation that scripts and browser features can access.
- A protocol used to transfer HTML from a server.
Correct answer: C — A structured document representation.
- A is incorrect because the DOM is not a website database.
- B is incorrect because the DOM is not a CSS stylesheet.
- C is correct because the DOM represents the document as a structure of nodes and objects.
- D is incorrect because HTTP and HTTPS are communication protocols.
Question 7: True or False — The viewport meta element automatically makes every webpage responsive.
- True
- False
Correct answer: B — False.
- True is incorrect because viewport metadata does not automatically create responsive layouts.
- False is correct because responsive behavior also depends on suitable CSS, layout choices and content.
Question 8: What does a browser commonly do when it encounters a new p start tag while another paragraph is still open?
- It always stops parsing the document.
- It treats the new p element as a CSS rule.
- It converts both paragraphs into one heading.
- It closes the previous paragraph during HTML parsing.
Correct answer: D — It closes the previous paragraph during HTML parsing.
- A is incorrect because browsers generally attempt to recover from common HTML errors.
- B is incorrect because p is an HTML element, not a CSS rule.
- C is incorrect because a paragraph start tag does not convert content into a heading.
- D is correct because HTML parsing rules close an open paragraph when a new p start tag is processed in this context.
Question 9: Which attribute identifies the primary language of an HTML document?
langcharsetviewportrel
Correct answer: A — lang.
- A is correct because lang identifies the language of the document or element.
- B is incorrect because charset specifies character encoding.
- C is incorrect because viewport is used in viewport metadata.
- D is incorrect because rel describes a relationship between a linked resource and the current document.
Question 10: What is a common effect of omitting a suitable DOCTYPE from an HTML document?
- The browser cannot display any HTML content.
- The browser may enter quirks mode.
- The browser automatically adds a server-side framework.
- The browser disables all CSS permanently.
Correct answer: B — The browser may enter quirks mode.
- A is incorrect because browsers can still parse and display HTML without DOCTYPE.
- B is correct because a missing or legacy-triggering DOCTYPE can cause quirks mode.
- C is incorrect because a browser does not add a server-side framework.
- D is incorrect because omitting DOCTYPE does not permanently disable CSS, although rendering behavior can change.
Congratulations!
You have completed Section 2 of Codementrix HTML5 Mastery. You now understand the structure of an HTML document, the purpose of DOCTYPE, metadata, character encoding, browser parsing and the DOM.
Next lesson: Section 3 — HTML Elements, Tags, Attributes and Nesting Rules.