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
- Document structure and DOCTYPE
- Headings, paragraphs, links and images
- Lists, tables and forms
- Semantic elements and attributes
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?
- HTML describes the structure of a webpage
- HTML is the standard markup language mainly used to create web pages
- HTML consists of a set of elements that helps the browser how to view the content
- 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?
- Rasmus Lerdorf
- Tim Berners-Lee
- Brendan Eich
- Sergey Brin
Answer: Tim Berners-Lee
Tim Berners-Lee invented the World Wide Web and created HTML.
3. HTML stands for ________.
- HyperText Markup Language
- HyperText Machine Language
- HyperText Marking Language
- HighText Marking Language
Answer: HyperText Markup Language
HTML stands for HyperText Markup Language.
4. What is the correct syntax of DOCTYPE declaration in HTML5?
- <!DOCTYPE html>
- </doctype html>
- <doctype html!>
- <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?
- Web server
- Web network
- Web browser
- 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?
- Charset in both HTML and XHTML is text/html
- Tags and attributes are case-insensitive in HTML but not in XHTML
- Special characters must be escaped in XHTML
- 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?
- <h1>
- <h2>
- <head>
- <heading>
Answer: <h1>
The <h1> tag defines the largest heading in HTML.
8. What is DOM in HTML?
- Language dependent application programming
- Hierarchy of objects in ASP.NET
- Application programming interface
- 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?
- <head>
- <body>
- <footer>
- <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?
- <u>
- <mark>
- <highlight>
- <b>
Answer: <mark>
The <mark> element highlights text.
11. Which of the following is NOT an HTML5 semantic element?
- <article>
- <section>
- <font>
- <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?
- <!-- Comment -->
- </ Comment >
- <! Comment !>
- // Comment
Answer: <!-- Comment -->
HTML comments are written using <!-- Comment -->.
13. Which HTML element is used to display video content?
- <video>
- <media>
- <movie>
- <embed>
Answer: <video>
The <video> element is used to embed video content in HTML5.
14. Which of the following is associated with HTML tables?
- Alignment
- Color
- Spanning
- Database
Answer: Spanning
Rowspan and colspan are used to span table rows and columns.
15. Which language is used for styling HTML pages?
- CSS
- JavaScript
- PHP
- Python
Answer: CSS
CSS is used to style HTML pages.
16. Which HTML tag makes text bold?
- <b>
- <strong>
- Both <b> and <strong>
- <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?
- src
- href
- link
- alt
Answer: src
The src attribute specifies the image path.
18. HTML is a subset of which language?
- SGML
- XML
- CSS
- Java
Answer: SGML
HTML was originally based on SGML.
19. Which character is used to close an HTML tag?
- #
- /
- \
- !
Answer: /
Closing tags use the forward slash (/).
20. How can you make an image clickable in HTML?
- Wrap the <img> tag inside an <a> tag
- Use the href attribute in <img>
- Use the link attribute
- 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.