HTML, or HyperText Markup Language, is the markup language used to create web pages. Before looking HTML MCQs and Answers, we must know the use of HTML language. Before making any home, we draw a plan or structure of that Understanding HTML is fundamental for anyone pursuing a career in web development. Here, we present several multiple-choice questions (MCQs) with answers to help you test and expand your HTML knowledge.
Proven HTML MCQs and Answers
What does HTML stand for?
a) Hyper Text Markup Language
b) Hyperlinks and Text Markup Language
c) Home Tool Markup Language
d) Hyperlinking Text Markup Language
Answer: a) Hyper Text Markup Language
Which is the correct HTML element for the largest heading?
a) <heading>
b) <h6>
c) <h1>
d) <head>
Answer c) <h1>
What is the correct HTML element for inserting a line break?
a) <lb>
b) <br>
c) <break>
d) <newline>
Answer: b) <br>
Which of these elements are all elements?
a) <table> <tr> <td>
b) <table> <thead> <tbody>
c) <thead> <tbody> <tr>
d) <table> <tr> <tt>
Answer: a) <table> <tr> <td>
How can you create an unordered list in HTML?
a) <ul>
b) <li>
c) <list>
d) <dl>
Answer: a) <ul>
Which HTML attribute is used to define inline styles?
a) font
b) styles
c) class
d) style
Answer: d) style
How can you create a numbered list in HTML?
a) <ul>
b) <li>
c) <ol>
d) <dl>
Answer: c) <ol>
How do you create a hyperlink in HTML?
a) <a href=”https://quizlancer.com/”>Link</a>
b) <a url=”https://quizlancer.com/”>Link</a>
c) <a>”https://quizlancer.com/”</a>
d) <link url=”https://quizlancer.com/”>Link</a>
Answer: a) <a href=”https://quizlancer.com/”>Link</a>
Which character is used to indicate an end tag?
a) /
b) \
c) !
d) *
Answer: a) /
15+ Comprehensive MCQ on Variables in PHP
How can you open a link in a new tab/browser window?
a) <a href=”https://quizlancer.com/” new>Link</a>
b) <a href=”https://quizlancer.com/” target=”_new”>Link</a>
c) <a href=”https://quizlancer.com/” target=”_blank”>Link</a>
d) <a href=”https://quizlancer.com/” target=”new”>Link</a>
Answer: a) <a href=”https://quizlancer.com/” target=”_blank”>Link</a>
How do you add a comment in HTML?
a) <!– This is a comment –>
b) // comment
c) /* comment */
d) ‘comment’
Answer: a) <!– This is a comment –>
Which HTML attribute specifies an alternate text for an image, if the image cannot be displayed?
a) title
b) src
c) alt
d) longdesc
Answer: c) alt
Which of the following elements is a block-level element by default?
a) <span>
b) <div>
c) <a>
d) <img>
Answer: b) <div>
What does the <canvas> element in HTML5 allow you to do?
a) Embed multimedia content
b) Draw graphics
c) Create form controls
d) Define a navigation structure
Answer: b) Draw graphics
MCQ Questions with Answers on Input Types in HTML
Which attribute can be used to provide a unique identifier to an HTML element?
a) class
b) id
c) name
d) key
Answer: b) id
What is the function of the <iframe> element?
a) To create a form
b) To include another document within the current HTML document
c) To add a horizontal line
d) To display a list item
Answer: b) To include another document within the current HTML document
What is the purpose of the <meta> tag in HTML?
a) To include multimedia content
b) To specify metadata about an HTML document
c) To link to external stylesheets
d) To create a division or section in a document
Answer: b) To specify metadata about an HTML document
What will be the output of the following HTML code?
<img src="image.jpg" alt="A beautiful scenery">
a) Displays the text “A beautiful scenery”
b) Displays an image with no alternate text
c) Displays an image and the text “A beautiful scenery” if the image cannot be displayed
d) Displays nothing if the image cannot be displayed
Answer: c) Displays an image and the text “A beautiful scenery” if the image cannot be displayed
What does the following HTML code do?
<form action="/submit" method="post">
<input type="text" name="username">
<input type="submit" value="Submit">
</form>
a) Sends form data using a GET request
b) Sends form data using a POST request
c) Does not send any data
d) Sends form data using a DELETE request
Answer: b) Sends form data using a POST request
What does the following HTML code do?
<input type="password" name="user_password">
a) Creates a text input field that hides the input text
b) Creates a text input field that shows the input text
c) Creates a password input field that shows the input text
d) Creates a button for password input
Answer: a) Creates a text input field that hides the input text
What will the following HTML code produce?
<input type="checkbox" checked>
a) A checkbox that is unchecked by default
b) A checkbox that is checked by default
c) A radio button that is checked by default
d) A text input field
Answer: b) A checkbox that is checked by default
What does the href attribute in the <a> tag specify?
a) The URL of the linked page
b) The target frame for the link
c) The style of the link
d) The color of the link
Answer: a) The URL of the linked page
How do you create an e-mail link in HTML?
a) <a href=”mailto:quizlancer@gmail.com”>Send Email</a>
b) <a href=”email:quizlancer@gmail.com”>Send Email</a>
c) <a href=”mailto quizlancer@gmail.com”>Send Email</a>
d) <a href=”quizlancer@gmail.com”>Send Email</a>
Answer: a) <a href=”mailto:quizlancer@gmail.com”>Send Email</a>
5 Reasons Why should we learn HTML in 2024? Is it Mandatory?
Which attribute is used to specify that an input field must be filled out before submitting the form?
a) required
b) placeholder
c) value
d) name
Answer: a) required
Which of the following is the correct way to add a background color in HTML?
a) <body background-color=”blue”>
b) <body bgcolor=”blue”>
c) <body style=”background-color:blue;”>
d) <body color=”blue”>
Answer: c) <body style=”background-color:blue;”>
How do you specify a default value for an input field in HTML?
a) default=”value”
b) value=”value”
c) placeholder=”value”
d) input=”value”
Answer: b) value=”value”
Which attribute is used to specify the path to an external stylesheet?
a) src
b) link
c) href
d) style
Answer: c) href
What does the colspan attribute do in a table?
a) Merges two or more cells horizontally
b) Merges two or more cells vertically
c) Adds a column
d) Deletes a column
Answer: a) Merges two or more cells horizontally
What does the rowspan attribute do in a table?
a) Merges two or more cells vertically
b) Merges two or more cells horizontally
c) Adds a row
d) Deletes a row
Answer: a) Merges two or more cells vertically
What is the correct way to specify the language attribute for an HTML document?
a) <html lang=”en”>
b) <html language=”en”>
c) <html lang=”english”>
d) <html language=”english”>
Answer: a) <html lang=”en”>
How do you define a multi-line text input field in HTML?
a) <input type=”textarea”>
b) <textarea>
c) <input type=”multiline”>
d) <input type=”text”>
Answer: b) <textarea>
What is the correct way to create an HTML comment?
a) <!– This is a comment –>
b) // This is a comment
c) /* This is a comment */
d) ** This is a comment **
Answer: a) <!– This is a comment –>
Follow us on Social Platforms for HTML MCQs and Answers
Follow Quiz Lancer Instagram, WhatsApp, Facebook, LinkedIn, Telegram Channel to solve daily MCQ on PHP Numbers. We share important interview questions which are asked in the interview. Most of the students get good values from this channel and got selected as a developer.