HTML Multiple Choice Questions and Answers: Test Your Skills!
30 Dec 2024
Intermediate
53 Views
45 min read
HTML MCQ Questions
HTML is the backbone of web development, and mastering it is essential for building amazing websites. Our HTML MCQ questions are designed to test your knowledge and help you sharpen your skills, whether you're a beginner or an experienced developer. These HTML MCQ questions cover a wide range of topics, from basic tags to advanced concepts, ensuring thorough preparation. Dive into this exciting collection of HTML MCQ questions to boost your confidence and excel in your web development journey!
In this Interview Tutorial, we will learn the exciting and important HTML MCQ questions with correct answers.
Top 100+ HTML MCQ Questions with Answers
Q 1: Who is known as the father of HTML?
(a) Tim Berners-Lee
(b) Dennis Ritchie
(c) James Gosling
(d) Bjarne Stroustrup
Answer: (a) Tim Berners-Lee
Explanation: Tim Berners-Lee invented HTML in 1991 while working at CERN to facilitate the sharing of information over the World Wide Web.
Q 2: What does HTML stand for?
(a) HyperText Markup Language
(b) HighText Machine Language
(c) HyperText Markdown Language
(d) None of the above
Answer: (a) HyperText Markup Language
Explanation: HTML stands for HyperText Markup Language, which is the standard markup language for creating web pages.
Q 3: Which tag is used to create a hyperlink in HTML?
(a) <link>
(b) <a>
(c) <href>
(d) <hyperlink>
Answer: (b) <a>
Explanation: The <a> tag is used to create hyperlinks in HTML, with the `href` attribute specifying the target URL.
Q 4: What is the purpose of the <head> tag in HTML?
(a) To define the main content of the document
(b) To contain metadata and links to external resources
(c) To create a heading on the page
(d) To define the footer of the document
Answer: (b) To contain metadata and links to external resources
Explanation: The <head> tag contains metadata such as the title, character set, and links to external CSS or JavaScript files.
Q 5: Which attribute is used to uniquely identify an HTML element?
(a) class
(b) id
(c) name
(d) style
Answer: (b) id
Explanation: The `id` attribute is used to uniquely identify an HTML element, allowing for precise styling or scripting.
Q 6: Which HTML tag is used to define an internal style sheet?
(a) <css>
(b) <script>
(c) <style>
(d) <link>
Answer: (c) <style>
Explanation: The <style> tag is used to define internal CSS rules within the HTML document.
Q 7: What is the correct HTML element for inserting a line break?
(a) <br>
(b) <break>
(c) <lb>
(d) <line>
Answer: (a) <br>
Explanation: The <br> tag is used to insert a line break in HTML, making the content appear on the next line.
Q 8: Which attribute specifies an alternate text for an image if the image cannot be displayed?
(a) title
(b) alt
(c) src
(d) href
Answer: (b) alt
Explanation: The `alt` attribute provides alternate text for an image if the image cannot be displayed due to an error or slow connection.
Q 9: Which HTML element is used to display a scalar measurement within a range?
(a) <meter>
(b) <progress>
(c) <gauge>
(d) <range>
Answer: (a) <meter>
Explanation: The <meter> element represents a scalar measurement within a known range, such as a disk usage or a fuel gauge.
Q 11: Which HTML tag is used to define an unordered list?
(a) <ul>
(b) <ol>
(c) <list>
(d) <li>
Answer: (a) <ul>
Explanation: The <ul> tag is used to create an unordered list in HTML, with list items defined by the <li> tag.
Q 12: Which tag is used to display a table in HTML?
(a) <td>
(b) <table>
(c) <tr>
(d) <th>
Answer: (b) <table>
Explanation: The <table> tag is used to define a table in HTML, and other tags like <tr>, <th>, and <td> are used to define rows and cells.
Q 13: Which HTML element is used for a definition list?
(a) <dl>
(b) <dt>
(c) <dd>
(d) <def>
Answer: (a) <dl>
Explanation: The <dl> tag is used to define a definition list in HTML, with <dt> used for the term and <dd> for the definition.
Q 14: Which HTML tag is used to define a table header?
(a) <th>
(b) <tr>
(c) <td>
(d) <thead>
Answer: (a) <th>
Explanation: The <th> tag is used to define table headers in HTML, and its content is bold and centered by default.
Q 15: What is the default value of the position property in CSS?
(a) relative
(b) absolute
(c) static
(d) fixed
Answer: (c) static
Explanation: The default value of the position property in CSS is static, meaning elements are positioned according to the normal document flow.
Q 16: How can you include a CSS file in an HTML document?
(a) <style>
(b) <link>
(c) <css>
(d) <script>
Answer: (b) <link>
Explanation: The <link> tag is used to link an external CSS file to an HTML document, typically placed inside the <head> section.
Q 17: What is the correct HTML element for inserting an image?
(a) <img>
(b) <image>
(c) <src>
(d) <picture>
Answer: (a) <img>
Explanation: The <img> tag is used to insert images into HTML, and the `src` attribute is used to specify the image path.
Q 18: Which attribute is used to define the destination of a link in HTML?
(a) href
(b) target
(c) src
(d) link
Answer: (a) href
Explanation: The `href` attribute specifies the URL of the page the link goes to. The `target` attribute can be used to control where the link opens.
Q 19: How do you make a hyperlink open in a new tab in HTML?
(a) target="_blank"
(b) target="_new"
(c) target="_tab"
(d) target="_self"
Answer: (a) target="_blank"
Explanation: The `target="_blank"` attribute ensures that the hyperlink will open in a new tab.
Q 20: What tag is used to define a footer in HTML5?
(a) <footer>
(b) <end>
(c) <bottom>
(d) <foot>
Answer: (a) <footer>
Explanation: The <footer> tag is used to define a footer for a document or section in HTML5, typically containing authorship, copyright, or other related information.
Q 21: Which HTML tag is used to define an input field?
(a) <input>
(b) <textfield>
(c) <textfield>
(d) <inputbox>
Answer: (a) <input>
Explanation: The <input> tag is used to define various types of user input fields in HTML, such as text, password, or checkbox.
Q 22: Which tag is used to define a text area in HTML?
(a) <text>
(b) <textarea>
(c) <input>
(d) <area>
Answer: (b) <textarea>
Explanation: The <textarea> tag is used to define a multi-line text input field, allowing users to enter large amounts of text.
Q 23: Which attribute is used to specify an alternative text for an image in HTML?
(a) alt
(b) src
(c) href
(d) title
Answer: (a) alt
Explanation: The `alt` attribute is used to specify alternative text for an image when it cannot be displayed. It helps with SEO and accessibility.
Q 24: Which HTML tag is used to define a hyperlink?
(a) <a>
(b) <link>
(c) <href>
(d) <url>
Answer: (a) <a>
Explanation: The <a> tag is used to define a hyperlink, and the `href` attribute is used to specify the link's destination.
Q 25: Which tag is used to define a row in an HTML table?
(a) <tr>
(b) <td>
(c) <th>
(d) <table>
Answer: (a) <tr>
Explanation: The <tr> tag defines a row in an HTML table. It is used to group the <th> and <td> elements together within a table.
Q 26: Which tag is used to define a table cell in HTML?
(a) <td>
(b) <tr>
(c) <th>
(d) <table>
Answer: (a) <td>
Explanation: The <td> tag is used to define a table cell in HTML, and it is used inside a <tr> tag.
Q 27: Which tag is used to create a line break in HTML?
(a) <br>
(b) <break>
(c) <lb>
(d) <line>
Answer: (a) <br>
Explanation: The <br> tag is used to create a line break in HTML, forcing the content after it to appear on a new line.
Q 28: Which HTML tag is used to define the header of a table?
(a) <th>
(b) <tr>
(c) <thead>
(d) <header>
Answer: (a) <th>
Explanation: The <th> tag is used to define the header cells in a table. It typically contains bold and centered text.
Q 29: Which tag is used to define a description list in HTML?
(a) <dl>
(b) <list>
(c) <description>
(d) <de>
Answer: (a) <dl>
Explanation: The <dl> tag is used to define a description list in HTML, and it is paired with <dt> for the term and <dd> for the description.
Q 30: Which tag is used to create a division or section in an HTML document?
(a) <div>
(b) <section>
(c) <group>
(d) <span>
Answer: (a) <div>
Explanation: The <div> tag is used to group content together and create sections or divisions within an HTML document.
Q 31: Which tag is used to define an unordered list in HTML?
(a) <ul>
(b) <ol>
(c) <li>
(d) <list>
Answer: (a) <ul>
Explanation: The <ul> tag is used to define an unordered list, which contains items marked with bullet points.
Q 32: Which tag is used to display an image in HTML?
(a) <img>
(b) <image>
(c) <picture>
(d) <photo>
Answer: (a) <img>
Explanation: The <img> tag is used to embed images in an HTML document. The `src` attribute defines the image source.
Q 33: Which tag is used to define a table header in HTML?
(a) <th>
(b) <td>
(c) <thead>
(d) <table>
Answer: (a) <th>
Explanation: The <th> tag is used to define a header cell in a table. It usually appears as bold and centered text.
Q 34: What is the correct HTML tag for inserting a line break?
(a) <br>
(b) <break>
(c) <lb>
(d) <line>
Answer: (a) <br>
Explanation: The <br> tag creates a line break in HTML, which forces the following content to appear on a new line.
Q 35: Which tag is used to define a hyperlink in HTML?
(a) <a>
(b) <link>
(c) <href>
(d) <url>
Answer: (a) <a>
Explanation: The <a> tag is used to create a hyperlink, with the `href` attribute specifying the link destination.
Q 36: Which HTML attribute is used to specify the URL of an image?
(a) href
(b) src
(c) alt
(d) target
Answer: (b) src
Explanation: The `src` attribute in the <img> tag is used to specify the URL of the image.
Q 37: Which tag is used to create a dropdown list in HTML?
(a) <select>
(b) <input>
(c) <dropdown>
(d) <option>
Answer: (a) <select>
Explanation: The <select> tag is used to create a dropdown list in HTML. The <option> tag is used to define individual items in the list.
Q 38: Which HTML tag is used to define the body of a document?
(a) <body>
(b) <content>
(c) <main>
(d) <section>
Answer: (a) <body>
Explanation: The <body> tag is used to define the body of the HTML document. It contains all the visible content of the web page.
Q 39: What does the <meta> tag do in HTML?
(a) Defines the title of the document
(b) Provides metadata about the HTML document
(c) Embeds an image in the document
(d) Creates a hyperlink to another page
Answer: (b) Provides metadata about the HTML document
Explanation: The <meta> tag provides metadata such as the character set, author, and description of the web page.
Q 40: Which tag is used to define a footer in HTML?
(a) <footer>
(b) <bottom>
(c) <end>
(d) <foot>
Answer: (a) <footer>
Explanation: The <footer> tag is used to define a footer section for a web page or a section of content, typically containing copyright and author information.
Q 41: What does the <link> tag define in an HTML document?
(a) Defines the character set
(b) Links an external resource to the document
(c) Embeds a video file
(d) Defines a navigation link
Answer: (b) Links an external resource to the document
Explanation: The <link> tag is used to link external resources like stylesheets or icons to an HTML document.
Q 42: What is the purpose of the <iframe> tag in HTML?
(a) To embed an image
(b) To define a navigation menu
(c) To embed another HTML page within a page
(d) To display a video
Answer: (c) To embed another HTML page within a page
Explanation: The <iframe> tag is used to embed an external document or HTML page within the current page.
Q 43: What does the <meta> tag define in an HTML document?
(a) Describes the document's metadata
(b) Embeds external JavaScript
(c) Defines the document's character set
(d) Specifies the document's title
Answer: (a) Describes the document's metadata
Explanation: The <meta> tag provides metadata such as description, keywords, and author of the web page, but does not display any content.
Q 44: Which tag is used to define a form in HTML?
(a) <form>
(b) <input>
(c) <button>
(d) <fieldset>
Answer: (a) <form>
Explanation: The <form> tag is used to define an HTML form for user input. It can include other form elements such as text inputs, buttons, and checkboxes.
Q 45: Which tag is used to define a clickable button in HTML?
(a) <input>
(b) <button>
(c) <click>
(d) <a>
Answer: (b) <button>
Explanation: The <button> tag is used to create a clickable button, which can be used to trigger a form submission or other actions.
Q 46: Which attribute is used to define the width of an image in HTML?
(a) width
(b) size
(c) height
(d) size-width
Answer: (a) width
Explanation: The `width` attribute is used in the <img> tag to define the width of the image. It can be set in pixels or as a percentage.
Q 47: What is the correct way to add a background color in HTML?
(a) background-color
(b) bg-color
(c) bgcolor
(d) background
Answer: (a) background-color
Explanation: The correct CSS property for setting the background color is `background-color`. The `bgcolor` attribute is deprecated.
Q 48: Which attribute is used to define the type of an <input> element in an HTML form?
(a) type
(b) value
(c) name
(d) form
Answer: (a) type
Explanation: The `type` attribute specifies the type of input element in an HTML form, such as text, password, checkbox, radio, etc.
Q 49: How do you create an ordered list in HTML?
(a) <ol>
(b) <ul>
(c) <li>
(d) <list>
Answer: (a) <ol>
Explanation: The <ol> tag is used to create an ordered list, where items are listed in a numbered order.
Q 50: Which tag is used to define a table in HTML?
(a) <table>
(b) <tr>
(c) <td>
(d) <th>
Answer: (a) <table>
Explanation: The <table> tag is used to define a table in HTML. Other tags like <tr>, <td>, and <th> define the rows, columns, and headers of the table respectively.
Q 51: Which tag is used to define an HTML paragraph?
(a) <p>
(b) <para>
(c) <text>
(d) <div>
Answer: (a) <p>
Explanation: The <p> tag is used to define a paragraph in HTML. It is one of the basic structural elements for writing text.
Q 52: What is the purpose of the <title> tag in HTML?
(a) Defines the title of the webpage
(b) Adds a subtitle to the webpage
(c) Specifies the character encoding
(d) Defines a heading in the webpage
Answer: (a) Defines the title of the webpage
Explanation: The <title> tag defines the title of the webpage, which appears in the browser's title bar or tab.
Q 53: Which attribute is used to specify the image source in HTML?
(a) src
(b) href
(c) alt
(d) url
Answer: (a) src
Explanation: The `src` attribute specifies the source URL of the image in the <img> tag.
Q 54: Which of the following tags is used to display a table heading?
(a) <th>
(b) <td>
(c) <tr>
(d) <table>
Answer: (a) <th>
Explanation: The <th> tag defines a table header, which is typically displayed in bold and centered.
Q 55: Which HTML element is used to define a division or section?
(a) <div>
(b) <span>
(c) <section>
(d) <header>
Answer: (a) <div>
Explanation: The <div> tag is used to define a division or section in an HTML document. It is a block-level container element.
Q 56: What is the default value of the <li> tag's list-style-type?
(a) Circle
(b) Square
(c) Disc
(d) None
Answer: (c) Disc
Explanation: By default, the list items in an unordered list (<ul>) are displayed with a disc (filled circle) as the list marker.
Q 57: Which tag is used to add a comment in an HTML document?
(a) <!-- comment -->
(b) <comment>
(c) <# comment >
(d) <// comment >
Answer: (a) <!-- comment -->
Explanation: In HTML, comments are written using the syntax <!-- comment -->. These are ignored by the browser and used for documentation.
Q 58: Which tag is used to define an input field in an HTML form?
(a) <input>
(b) <textarea>
(c) <select>
(d) <button>
Answer: (a) <input>
Explanation: The <input> tag is used to define an input field in an HTML form. It can take different types like text, password, checkbox, etc.
Q 59: Which HTML tag is used to define a checkbox?
(a) <input type="checkbox">
(b) <checkbox>
(c) <check>
(d) <input type="radio">
Answer: (a) <input type="checkbox">
Explanation: The <input type="checkbox"> tag is used to create checkboxes, allowing users to select multiple options.
Q 60: Which of the following tags is used to create an unordered list?
(a) <ul>
(b) <ol>
(c) <li>
(d) <list>
Answer: (a) <ul>
Explanation: The <ul> tag is used to define an unordered list, where items are typically displayed with bullet points.
Conclusion
In conclusion, HTML MCQ questions are an excellent way to test and enhance your understanding of HTML fundamentals. Whether you're preparing for exams or interviews, practicing these HTML MCQquestions helps build a strong foundation in web development. By mastering key concepts through HTML MCQquestions, you can confidently tackle challenges in creating well-structured, semantic, and interactive web pages.
Dear learners, join our Tech Trendy Masterclasses to help you to learn and immerse yourself in the latest trending technologies and upgrade your tech skills with the latest skills trends, design, and practices.
The latest version is HTML5, which introduced new semantic tags, multimedia support, and APIs.
HTML is more flexible with syntax, while XHTML is stricter and follows XML rules for well-formedness.
Semantic HTML uses tags like <header>, <footer>, <article>, etc., to improve readability and accessibility.
The <!DOCTYPE> declaration defines the HTML version being used (e.g., HTML5). It ensures that browsers render the document correctly, following the defined standards, and prevents quirks mode where older rendering rules may apply.
Block-level elements (e.g., <div>, <p>) start on a new line and take up the full width of their parent container. Inline elements (e.g., <span>, <a>) remain on the same line as surrounding content and take up only as much width as needed.
Shailendra Chauhan (Microsoft MVP, Founder & CEO at ScholarHat)
Shailendra Chauhan, Founder and CEO of ScholarHat by DotNetTricks, is a renowned expert in System Design, Software Architecture, Azure Cloud, .NET, Angular, React, Node.js, Microservices, DevOps, and Cross-Platform Mobile App Development. His skill set extends into emerging fields like Data Science, Python, Azure AI/ML, and Generative AI, making him a well-rounded expert who bridges traditional development frameworks with cutting-edge advancements. Recognized as a Microsoft Most Valuable Professional (MVP) for an impressive 9 consecutive years (2016–2024), he has consistently demonstrated excellence in delivering impactful solutions and inspiring learners.
Shailendra’s unique, hands-on training programs and bestselling books have empowered thousands of professionals to excel in their careers and crack tough interviews. A visionary leader, he continues to revolutionize technology education with his innovative approach.