Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

HTML MCQs

1. What is the purpose of commenting code in HTML?

a) To make text bold
b) To provide instructions for the browser
c) To hide code from users
d) To change the font style

Answer: b) To provide instructions for the browser

Explanation: Comments in HTML are used to provide notes or instructions within the code that are not displayed on the web page. They help developers document their code and communicate with other developers who may work on the project.


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

a) <link>
b) <a>
c) <href>
d) <hyperlink>

Answer: b) <a>

Explanation: The <a> tag, also known as the anchor tag, is used to create hyperlinks in HTML. It is commonly used in combination with the href attribute to specify the URL of the page to which the link should point.


3. What is the purpose of Meta tags in HTML?

a) To define the structure of the webpage
b) To specify the color scheme
c) To provide metadata about the webpage
d) To create tables

Answer: c) To provide metadata about the webpage

Explanation: Meta tags are used to provide metadata about an HTML document. This metadata includes information such as the page’s title, description, keywords, author, and viewport settings. Search engines and other web services often use meta tags to better understand and categorize web pages.


4. Which tag is used to insert an image in HTML?

a) <img>
b) <image>
c) <picture>
d) <src>

Answer: a) <img>

Explanation: The <img> tag is used to insert images into an HTML document. It requires the src attribute to specify the path to the image file.


5. What does HTML5 introduce to replace frames and frame sets?

a) Divisions
b) Sections
c) Iframes
d) Frameset

Answer: c) Iframes

Explanation: XHTML stands for Extensible Hypertext Markup Language. It is a stricter and cleaner version of HTML that follows the XML syntax rules.

6. Which version of HTML introduced the concept of semantic elements?

a) HTML 4
b) HTML 5
c) XHTML
d) HTML 3

Answer: b) HTML 5

Explanation: HTML5 introduced semantic elements such as <header>, <footer>, <nav>, <article>, <section>, and <aside>, which provide more meaningful tags to describe the structure of a web page’s content.


7. What is the purpose of character entities in HTML?

a) To define special characters that cannot be typed directly
b) To create animations
c) To change font sizes
d) To define the background color

Answer: a) To define special characters that cannot be typed directly

Explanation: Character entities in HTML are used to represent special characters that cannot be easily typed on a keyboard, such as &, <, >, ©, etc.


8. Which HTML tag is used to define a list of items?

a) <ul>
b) <list>
c) <ol>
d) <li>

Answer: a) <ul>

Explanation: The <ul> tag is used to define an unordered list in HTML, where the list items are displayed with bullet points by default.


9. What is the purpose of the <table> tag in HTML?

a) To create a form
b) To display tabular data
c) To insert images
d) To define hyperlinks

Answer: b) To display tabular data

Explanation: The <table> tag in HTML is used to create tables to display tabular data, with rows and columns.


10. What does XHTML stand for?

a) Extended Hypertext Markup Language
b) Extensible Hypertext Markup Language
c) Excessive Hypertext Markup Language
d) Extraordinary Hypertext Markup Language

Answer: b) Extensible Hypertext Markup Language

Explanation: XHTML stands for Extensible Hypertext Markup Language. It is a stricter and cleaner version of HTML that follows the XML syntax rules.

Leave a Comment