HomeSubjectsUniversityBlogAbout

HTML Fundamentals

Topic in Web Development

210 total MCQsShowing 30 with explanations10 Easy10 Medium10 Hard

About This Topic

HTML (HyperText Markup Language) is the standard markup language that defines the structure and meaning of web page content using elements and attributes. Basic MCQs ask which tag creates a paragraph, link, image, list or table, and what attributes like href, src, alt and id do. Semantic HTML5 elements are a big area: header, nav, main, section, article, aside and footer, and when to prefer each over a div. Forms bring questions on input types, labels, fieldset, and validation attributes such as required and pattern. More advanced items cover the DOCTYPE, meta tags, accessibility with ARIA, responsive images using srcset and sizes, and Shadow DOM.

Below are 30 practice questions from a pool of 210 HTML Fundamentals MCQs, one of 17 topics in Web Development. Each shows the correct answer with an explanation; when you are ready, take a timed quiz to test recall under exam conditions.

Practice Questions

Each question below shows the correct answer with a full explanation. Use these to build conceptual understanding before attempting a timed quiz.

HTML FundamentalsEasy

Q1. Which HTML tag is used to create a paragraph?

  1. A.<pg>
  2. B.<para>
  3. C.<p>✓ Correct
  4. D.<text>

Explanation

The <p> tag defines a paragraph in HTML.

Report an error in this question

HTML FundamentalsEasy

Q2. What is the correct HTML tag for the largest heading?

  1. A.<head> tag
  2. B.<heading>
  3. C.<h6> tag
  4. D.<h1> tag✓ Correct

Explanation

The <h1> tag defines the largest heading in HTML.

Report an error in this question

HTML FundamentalsEasy

Q3. Which HTML tag is used to create a hyperlink?

  1. A.<a>✓ Correct
  2. B.<url>
  3. C.<link>
  4. D.<href>

Explanation

The <a> (anchor) tag creates hyperlinks in HTML.

Report an error in this question

HTML FundamentalsEasy

Q4. Which attribute specifies the URL in an anchor tag?

  1. A.href✓ Correct
  2. B.url
  3. C.link
  4. D.src

Explanation

The href attribute specifies the URL that the hyperlink points to.

Report an error in this question

HTML FundamentalsEasy

Q5. What is the correct HTML tag for inserting an image?

  1. A.<photo>
  2. B.<image>
  3. C.<pic>
  4. D.<img>✓ Correct

Explanation

The <img> tag embeds images in HTML.

Report an error in this question

HTML FundamentalsEasy

Q6. Which HTML tag creates an unordered list?

  1. A.<list>
  2. B.<ul>✓ Correct
  3. C.<li>
  4. D.<ol>

Explanation

The <ul> tag creates an unordered (bulleted) list.

Report an error in this question

HTML FundamentalsEasy

Q7. What does the <br> tag do?

  1. A.Creates a border
  2. B.Makes text bigger
  3. C.Creates bold text
  4. D.Inserts a line break✓ Correct

Explanation

The <br> tag inserts a single line break.

Report an error in this question

HTML FundamentalsEasy

Q8. Which HTML tag makes text bold?

  1. A.Only the <b> tag
  2. B.Only the <strong> tag
  3. C.The <bold> tag only
  4. D.Both <b> and <strong>✓ Correct

Explanation

Both <b> and <strong> make text bold; <strong> also conveys semantic importance.

Report an error in this question

HTML FundamentalsEasy

Q9. What is the root element of an HTML document?

  1. A.<html>✓ Correct
  2. B.<head>
  3. C.<doctype>
  4. D.<body>

Explanation

The <html> tag is the root element that wraps all content.

Report an error in this question

HTML FundamentalsEasy

Q10. Which tag defines a table row in HTML?

  1. A.<td> tag
  2. B.<tr> tag✓ Correct
  3. C.<th> tag
  4. D.<table> tag

Explanation

The <tr> tag defines a row within an HTML table.

Report an error in this question

HTML FundamentalsMedium

Q11. What is the purpose of the <meta> tag?

  1. A.To provide metadata about the document to browser✓ Correct
  2. B.To link external CSS files to the HTML document
  3. C.To display visible metadata on the page directly
  4. D.To create a navigation menu within the header area

Explanation

The <meta> tag provides metadata such as character set, viewport settings, and descriptions.

Report an error in this question

HTML FundamentalsMedium

Q12. Which HTML5 tag is used for navigation links?

  1. A.<links> element
  2. B.<nav> element✓ Correct
  3. C.<navigation> tag
  4. D.<menu> element

Explanation

The <nav> tag defines a section of navigation links in HTML5.

Report an error in this question

HTML FundamentalsMedium

Q13. What is the difference between <div> and <span>?

  1. A.They are identical in every behavior
  2. B.<span> is not able to contain any text
  3. C.<div> is inline, <span> is block-level
  4. D.<div> is block-level, <span> is inline✓ Correct

Explanation

<div> is a block-level container, while <span> is inline.

Report an error in this question

HTML FundamentalsMedium

Q14. Which attribute provides alternative text for an image?

  1. A.label
  2. B.desc
  3. C.title
  4. D.alt✓ Correct

Explanation

The alt attribute provides alternative text for accessibility and when images fail to load.

Report an error in this question

HTML FundamentalsMedium

Q15. What is the purpose of the <form> tag?

  1. A.To create a form for user input✓ Correct
  2. B.To format and style text content
  3. C.To create a page footer section
  4. D.To add mathematical formulas

Explanation

The <form> tag creates a form that collects user input.

Report an error in this question

HTML FundamentalsMedium

Q16. Which input type creates a checkbox?

  1. A.type='checkbox'✓ Correct
  2. B.type='box'
  3. C.type='check'
  4. D.type='tick'

Explanation

Setting type='checkbox' on an <input> creates a checkbox.

Report an error in this question

HTML FundamentalsMedium

Q17. What is the purpose of the action attribute in a form?

  1. A.To apply CSS styles to the form
  2. B.To specify where form data is sent✓ Correct
  3. C.To validate the form input fields
  4. D.To add a JavaScript event handler

Explanation

The action attribute specifies the URL where form data is sent.

Report an error in this question

HTML FundamentalsMedium

Q18. Which HTML5 element is used for self-contained content like a blog post?

  1. A.<article>✓ Correct
  2. B.<div>
  3. C.<section>
  4. D.<aside>

Explanation

The <article> element represents self-contained content.

Report an error in this question

HTML FundamentalsMedium

Q19. What does target='_blank' do in an anchor tag?

  1. A.Closes the current browser tab
  2. B.Opens the link in a new tab✓ Correct
  3. C.Downloads the linked file
  4. D.Opens the link in the same tab

Explanation

target='_blank' opens the linked URL in a new tab or window.

Report an error in this question

HTML FundamentalsMedium

Q20. Which tag embeds a video in HTML5?

  1. A.<embed>
  2. B.<movie>
  3. C.<video>✓ Correct
  4. D.<media>

Explanation

The <video> tag embeds video content in HTML5.

Report an error in this question

HTML FundamentalsHard

Q21. What is the purpose of the data-* attribute in HTML5?

  1. A.To define strict data types for form fields
  2. B.To store custom data accessible via JavaScript✓ Correct
  3. C.To store CSS data in external stylesheets
  4. D.To create connections to external databases

Explanation

data-* attributes store custom data on elements accessible via JavaScript's dataset property.

Report an error in this question

HTML FundamentalsHard

Q22. What is the Shadow DOM?

  1. A.A hidden HTML element in the page structure
  2. B.An encapsulated DOM tree that isolates styles✓ Correct
  3. C.A dark mode feature provided by CSS natively
  4. D.A deprecated feature from earlier HTML versions

Explanation

The Shadow DOM provides encapsulation by attaching a hidden DOM tree to an element.

Report an error in this question

HTML FundamentalsHard

Q23. What is the purpose of the <template> tag in HTML5?

  1. A.To create reusable email template layouts
  2. B.To define HTML content not rendered until activated✓ Correct
  3. C.To create reusable CSS template style blocks
  4. D.To import external HTML files into a document

Explanation

The <template> tag holds HTML content not rendered until instantiated via JavaScript.

Report an error in this question

HTML FundamentalsHard

Q24. Which attribute makes an HTML element editable?

  1. A.editable='true'
  2. B.edit='true'
  3. C.writable='true'
  4. D.contenteditable='true'✓ Correct

Explanation

The contenteditable attribute makes an element's content editable directly in the browser.

Report an error in this question

HTML FundamentalsHard

Q25. What is the purpose of the srcset attribute in <img>?

  1. A.To set the image dimensions and size
  2. B.To provide multiple sources for responsive images✓ Correct
  3. C.To add a link to the image source code
  4. D.To set the primary image source URL

Explanation

srcset allows the browser to choose the best image source based on device resolution.

Report an error in this question

HTML FundamentalsHard

Q26. What is an HTML Web Component?

  1. A.A standard built-in HTML tag element
  2. B.A server-side rendering technique for pages
  3. C.A type of CSS framework for web styling
  4. D.A reusable custom element with encapsulated code✓ Correct

Explanation

Web Components combine Custom Elements, Shadow DOM, and HTML Templates for reusable elements.

Report an error in this question

HTML FundamentalsHard

Q27. What does the defer attribute do on a <script> tag?

  1. A.Prevents the script from ever running on page
  2. B.Downloads script in parallel and runs after parsing✓ Correct
  3. C.Makes the script load and execute asynchronously
  4. D.Defers the loading of CSS stylesheets

Explanation

defer downloads the script without blocking parsing and executes it after the document is fully parsed.

Report an error in this question

HTML FundamentalsHard

Q28. What is the difference between defer and async in script loading?

  1. A.async preserves execution order; defer does not order them
  2. B.defer blocks page rendering; async does not block rendering
  3. C.defer runs after parsing in order; async runs on download✓ Correct
  4. D.They behave the same in all situations

Explanation

defer executes after parsing in document order, while async executes immediately when downloaded.

Report an error in this question

HTML FundamentalsHard

Q29. What is ARIA in HTML?

  1. A.A type of interactive HTML form input element
  2. B.A client-side JavaScript rendering framework
  3. C.A CSS animation and transition effects library
  4. D.Accessible Rich Internet Applications attributes✓ Correct

Explanation

ARIA provides attributes that make dynamic web content more accessible to users with disabilities.

Report an error in this question

HTML FundamentalsHard

Q30. What is the purpose of the <picture> element in HTML5?

  1. A.To embed inline SVG graphics within the page
  2. B.To provide multiple sources for responsive images✓ Correct
  3. C.To create a drawing canvas for vector graphics
  4. D.To display a photo gallery with thumbnails

Explanation

The <picture> element allows the browser to choose the best image based on media conditions.

Report an error in this question

Ready to test yourself on HTML Fundamentals?

Take a timed quiz drawn from 210+ questions on this topic. No signup required — your progress saves in your browser.

Start HTML Fundamentals Quiz