- A — Incorrect: The word "false" does not disable a Boolean attribute.
- B — Incorrect: The attribute is still present in the markup.
- C — Correct: Boolean attributes are true when present. Remove required to make the control not required.
- D — Incorrect: required does not delete an element.
Question 6: Which example shows correct nesting?
<p><strong>Hello</p></strong><p><strong>Hello</strong></p><p><strong>Hello</p></strong>Hello<p>
Correct answer: B
- A — Incorrect: The paragraph closes before the nested strong element.
- B — Correct: The inner strong element closes before the outer paragraph.
- C — Incorrect: The strong element has no explicit closing tag in this example, and the nesting is incomplete.
- D — Incorrect: The closing strong tag appears before its corresponding opening tag.
Question 7: Which statement about id and class is correct?
- An ID should be unique within the document, while classes can be reused
- Every element must have an ID
- A class can only be assigned to one element
- An ID is used only for image files
Correct answer: A
- A — Correct: IDs identify individual elements, while classes support reusable grouping and styling.
- B — Incorrect: Most HTML elements do not require an ID.
- C — Incorrect: The same class can be used on many elements.
- D — Incorrect: IDs can identify many kinds of elements, not only images.
Question 8: What is the problem with this markup?
<div class="card" class="featured">Course</div>- HTML elements cannot have classes
- The div element is a void element
- The same attribute is repeated twice
- Text cannot appear inside a div
Correct answer: C
- A — Incorrect: A div can have a class attribute.
- B — Incorrect: A div is not a void element.
- C — Correct: The class attribute is duplicated. Use
class="card featured"instead. - D — Incorrect: A div can contain text and other permitted content.
Question 9: Why should you quote attribute values consistently?
- HTML requires every attribute value to be a number
- Quotes make values containing spaces safe to parse and improve readability
- Quotes automatically validate all URLs
- Quotes turn every attribute into a Boolean attribute
Correct answer: B
- A — Incorrect: Attribute values can be text, URLs, numbers, and other permitted values.
- B — Correct: Quoting avoids ambiguity for values with spaces and makes markup more readable.
- C — Incorrect: Quotes do not validate whether a URL is safe or correct.
- D — Incorrect: Quoting a value does not change the attribute's type.
Question 10: What is the best way to check whether your HTML markup conforms to HTML rules?
- Check only whether the page looks correct
- Use an HTML validator and inspect the DOM in browser Developer Tools
- Remove every closing tag
- Put every element inside a paragraph
Correct answer: B
- A — Incorrect: Browsers can recover from invalid markup, so visual appearance alone does not prove conformance.
- B — Correct: An HTML validator can report conformance problems, and Developer Tools help you inspect the parsed DOM.
- C — Incorrect: Many elements require closing tags, and removing them indiscriminately creates errors.
- D — Incorrect: Paragraphs have content restrictions and cannot contain arbitrary elements.