Html: 18 MCQs with answers
All 18 multiple-choice questions from this kit, free and with no sign-up.
Warm-up · 13 questions
Q1. Which HTML element is used to define the root of an HTML document?
BeginnerShow answer & explanation
<html>
The element is the root element of an HTML page, wrapping all other content.
Q2. What is the purpose of the <head> element in an HTML document?
BeginnerShow answer & explanation
To contain metadata and links to resources
The element holds metadata, title, and links to stylesheets or scripts, not visible content.
Q3. Which attribute is used to specify a unique identifier for an HTML element?
BeginnerShow answer & explanation
id
The id attribute provides a unique identifier for an element, used for targeting with CSS or JavaScript.
Q4. What does the <a> element require to create a hyperlink?
BeginnerShow answer & explanation
href attribute
The href attribute specifies the URL the link points to, making the element functional.
Q5. Which HTML element is used to insert a line break?
BeginnerShow answer & explanation
<br>
The element inserts a line break without starting a new paragraph.
Q6. What is the correct way to comment in HTML?
BeginnerShow answer & explanation
<!-- comment -->
HTML comments are enclosed in , ignored by the browser.
Q7. Which HTML element is used to define a table row?
BeginnerShow answer & explanation
<tr>
The element defines a table row, containing or cells.
Q8. Which element is used to define a list item in an unordered list?
BeginnerShow answer & explanation
<li>
The element represents a list item, used inside or .
Q9. What is the purpose of the 'src' attribute in the <img> element?
BeginnerShow answer & explanation
To specify the image source URL
The src attribute specifies the path to the image file to be displayed.
Q10. Which HTML element is used to define a paragraph?
BeginnerShow answer & explanation
<p>
The element defines a paragraph, automatically adding space before and after.
Q11. Which element is used to define a heading of the highest level?
BeginnerShow answer & explanation
<h1>
is the highest-level heading, typically used for the main title.
Q12. The <title> element is placed inside the <body> element.
BeginnerShow answer & explanation
False
The element is placed inside the , not the .
Q13. HTML attributes provide additional information about elements and are always specified in the opening tag.
BeginnerShow answer & explanation
True
Attributes are key-value pairs placed in the opening tag to modify element behavior or appearance.
Building up · 5 questions
Q14. Which attribute is used to provide alternative text for an image in the <img> element?
IntermediateShow answer & explanation
alt
The alt attribute provides alternative text for accessibility and when the image fails to load.
Q15. What is the difference between <div> and <span> elements?
IntermediateShow answer & explanation
<div> is block-level, <span> is inline
is a block-level element (takes full width), while is an inline element (only takes needed space).
Q16. What does the 'target' attribute do in an <a> element?
IntermediateShow answer & explanation
Specifies where to open the linked document
The target attribute controls where the linked page opens, e.g., '_blank' for a new tab.
Q17. What does the 'class' attribute do in HTML?
IntermediateShow answer & explanation
Assigns one or more class names for styling
The class attribute is used to assign CSS classes, allowing multiple elements to share styles.
Q18. The <br> element is a void element and does not require a closing tag.
IntermediateShow answer & explanation
True
Void elements like have no content and are self-closing, so no closing tag is needed.
Your notes can be a kit like these
Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free, in 42 languages.
- Chapter notes
- Flashcards
- Practice MCQs
- Scored tests
- Exam prep
Get Veda free See what students get
Free to start · No ads · Works in 42 languages