HTML Quiz

HTML (HyperText Markup Language) gives every web page its structure. This quiz covers the fundamentals: what HTML is, how documents are laid out, common tags and attributes, and how browsers read markup. It is a good first quiz for anyone starting web development.

What this quiz covers

Study tip: Open a browser’s developer tools on any website and inspect its HTML; matching real markup to quiz questions makes the tags easier to remember.

Questions, answers and explanations

1. What is HTML?

  1. HTML describes the structure of a webpage
  2. HTML is the standard markup language mainly used to create web pages
  3. HTML consists of a set of elements that helps the browser how to view the content
  4. All of the mentioned

Answer: All of the mentioned

HTML defines the structure of web pages using markup elements.

2. Who is the father of HTML?

  1. Rasmus Lerdorf
  2. Tim Berners-Lee
  3. Brendan Eich
  4. Sergey Brin

Answer: Tim Berners-Lee

Tim Berners-Lee invented the World Wide Web and created HTML.

3. HTML stands for ________.

  1. HyperText Markup Language
  2. HyperText Machine Language
  3. HyperText Marking Language
  4. HighText Marking Language

Answer: HyperText Markup Language

HTML stands for HyperText Markup Language.

4. What is the correct syntax of DOCTYPE declaration in HTML5?

  1. <!DOCTYPE html>
  2. </doctype html>
  3. <doctype html!>
  4. <DOCTYPE html>

Answer: <!DOCTYPE html>

Every HTML5 document begins with <!DOCTYPE html>.

5. Which of the following is used to read an HTML page and render it?

  1. Web server
  2. Web network
  3. Web browser
  4. Web matrix

Answer: Web browser

Browsers like Chrome and Firefox render HTML pages.

6. Which of the following is NOT a difference between HTML and XHTML?

  1. Charset in both HTML and XHTML is text/html
  2. Tags and attributes are case-insensitive in HTML but not in XHTML
  3. Special characters must be escaped in XHTML
  4. HTML uses text/html while XHTML uses application/xhtml+xml

Answer: Charset in both HTML and XHTML is text/html

The other options describe actual differences.

7. Which tag is used for the largest heading?

  1. <h1>
  2. <h2>
  3. <head>
  4. <heading>

Answer: <h1>

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

8. What is DOM in HTML?

  1. Language dependent application programming
  2. Hierarchy of objects in ASP.NET
  3. Application programming interface
  4. Convention for representing and interacting with objects in HTML documents

Answer: Convention for representing and interacting with objects in HTML documents

DOM stands for Document Object Model.

9. In which part of the HTML document is metadata contained?

  1. <head>
  2. <body>
  3. <footer>
  4. <meta>

Answer: <head>

Metadata such as title, links, styles, and meta tags are placed inside the <head> element.

10. Which element is used to highlight text in HTML5?

  1. <u>
  2. <mark>
  3. <highlight>
  4. <b>

Answer: <mark>

The <mark> element highlights text.

11. Which of the following is NOT an HTML5 semantic element?

  1. <article>
  2. <section>
  3. <font>
  4. <nav>

Answer: <font>

The <font> tag is deprecated in HTML5. Semantic elements like <article>, <section>, and <nav> provide meaning to the webpage structure.

12. How do we write comments in HTML?

  1. <!-- Comment -->
  2. </ Comment >
  3. <! Comment !>
  4. // Comment

Answer: <!-- Comment -->

HTML comments are written using <!-- Comment -->.

13. Which HTML element is used to display video content?

  1. <video>
  2. <media>
  3. <movie>
  4. <embed>

Answer: <video>

The <video> element is used to embed video content in HTML5.

14. Which of the following is associated with HTML tables?

  1. Alignment
  2. Color
  3. Spanning
  4. Database

Answer: Spanning

Rowspan and colspan are used to span table rows and columns.

15. Which language is used for styling HTML pages?

  1. CSS
  2. JavaScript
  3. PHP
  4. Python

Answer: CSS

CSS is used to style HTML pages.

16. Which HTML tag makes text bold?

  1. <b>
  2. <strong>
  3. Both <b> and <strong>
  4. <bold>

Answer: Both <b> and <strong>

Both <b> and <strong> display bold text, but <strong> also adds semantic importance.

17. Which attribute is used to display an image in HTML?

  1. src
  2. href
  3. link
  4. alt

Answer: src

The src attribute specifies the image path.

18. HTML is a subset of which language?

  1. SGML
  2. XML
  3. CSS
  4. Java

Answer: SGML

HTML was originally based on SGML.

19. Which character is used to close an HTML tag?

  1. #
  2. /
  3. \
  4. !

Answer: /

Closing tags use the forward slash (/).

20. How can you make an image clickable in HTML?

  1. Wrap the <img> tag inside an <a> tag
  2. Use the href attribute in <img>
  3. Use the link attribute
  4. Use the onclick attribute only

Answer: Wrap the <img> tag inside an <a> tag

An image becomes clickable when it is placed inside an anchor (<a>) element.

Take the timed quiz