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?

Beginner
A <document> B <body> C <html> D <head>
Show 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?

Beginner
A To define a navigation menu B To contain metadata and links to resources C To display the main content of the page D To create a footer section
Show 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?

Beginner
A class B name C id D style
Show 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?

Beginner
A src attribute B href attribute C link attribute D url attribute
Show 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?

Beginner
A <br> B <newline> C <lb> D <break>
Show answer & explanation

<br>

The element inserts a line break without starting a new paragraph.

Q6. What is the correct way to comment in HTML?

Beginner
A /* comment */ B # comment C // comment D <!-- comment -->
Show answer & explanation

<!-- comment -->

HTML comments are enclosed in , ignored by the browser.

Q7. Which HTML element is used to define a table row?

Beginner
A <th> B <td> C <table> D <tr>
Show 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?

Beginner
A <item> B <ol> C <ul> D <li>
Show 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?

Beginner
A To add a border B To set the image width C To provide alternative text D To specify the image source URL
Show 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?

Beginner
A <p> B <para> C <paragraph> D <text>
Show 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?

Beginner
A <h6> B <h1> C <heading> D <head>
Show answer & explanation

<h1>

is the highest-level heading, typically used for the main title.

Q12. The <title> element is placed inside the <body> element.

Beginner
A True B False
Show 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.

Beginner
A True B False
Show 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?

Intermediate
A title B desc C alt D caption
Show 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?

Intermediate
A <div> is block-level, <span> is inline B Both are block-level C <div> is inline, <span> is block-level D Both are inline
Show 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?

Intermediate
A Specifies where to open the linked document B Adds a tooltip C Specifies the URL D Sets the link color
Show 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?

Intermediate
A Assigns one or more class names for styling B Assigns a unique identifier C Defines a hyperlink D Sets the element's display type
Show 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.

Intermediate
A True B False
Show answer & explanation

True

Void elements like have no content and are self-closing, so no closing tag is needed.

Make your own

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