HTML MCQ (Multiple Choice Questions)

HTML Multiple Choice Questions

1) What does HTML stand for?

  1. Hypertext Markup Language
  2. Home Tool Markup Language
  3. Hyperlinks and Text Markup Language
  4. None of the above
Answer: a. Hypertext Markup Language Explanation: HTML stands for Hypertext Markup Language. It is a code that is typically used to give structure to a web page and the content in it.

2) Which amongst the following is the correct HTML tag for the largest heading?

  1. <head>
  2. <h1>
  3. <heading>
  4. None of the above
Answer: b. <h1> Explanation: <h1> is a HTML element used for displaying the largest heading on a web page.

3) Which amongst the following is responsible for inserting a line break in HTML?

  1. <tr>
  2. <br>
  3. <lb>
  4. <break>
Answer: b. <br> Explanation: The HTML element <br> is used for inserting a line break. It is typically used while writing addresses and personal information, where the lines need to be divided.

4) What type of language is HTML?

  1. Scripting language
  2. Programming language
  3. Markup language
  4. None of the above
Answer: c. Markup language Explanation: HTML is a Markup language because it sums up the data inside the HTML tags.

5) What is the HTML code for adding a background color?

  1. <body style= "background-color:red;">
  2. <background>red</background>
  3. <bg>red</bg>
  4. None of the above
Answer: a. <body style= "background-color:red;"> Explanation: To add background color in HTML, "style" attribute is used. The "style" attribute states the inline style for an element. The "style" attribute is used with "body" tag in HTML where the web designer can add the background color.

6) Which amongst the following tags is used to specify important texts in HTML?

  1. <b>
  2. <important>
  3. <imptext>
  4. <strong>
Answer: d. <strong> Explanation: <strong> tag is used for defining the important texts in HTML. The <strong> tag highlights the content semantically and denote the text or any other content inside it important. This tag displays the content inside it in bold manner.

7) Which amongst the following tags is used to make the text bold in HTML?

  1. <b>
  2. <bold>
  3. <bd>
  4. <a>
Answer: a. <b> Explanation: <b> tag is used to make the text bold in HTML. It does not give any semantic meaning to the text.

8) What is the main difference between <strong> tag and <b> tag in HTML?

  1. <strong> tag is used to make text bold only, and <b> tag adds extra semantic importance to the content
  2. <strong> tag adds extra semantic importance to the content, and <b> tag is used to make text bold only
  3. There is no difference between <strong> tag and <b> tag
  4. None of the above
Answer: <strong> tag adds extra semantic importance to the content, and <b> tag is used to make text bold only Explanation: The only difference between <strong> tag and <b> tag is that the <strong> tag adds semantic importance to the content inside it; on the contrary, the <b> tag does not give any extra importance to the text apart from making it bold.

9) Which amongst the following tags is used to mark the beginning of a paragraph in HTML?

  1. <a>
  2. <br>
  3. <hr>
  4. <p>
Answer: d. <p> Explanation: <p> tag is used for defining a paragraph of in HTML.

10) Which tag is the first tag in a HTML document?

  1. <head>
  2. <body>
  3. <title>
  4. <html>
Answer: d. <html> Explanation: <html> is the first tag in a HTML document. It represents the root of an HTML document. It contains all the other tags of HTML.

11) Which of the following is the attribute of <form> tag in HTML?

  1. Action
  2. Method
  3. Both (a) and (b)
  4. None of the above
Answer: c. Both (a) and (b). Explanation: The <form> tag's Attribute in HTML is used to define that the element can contain one or more forms.

12) Which amongst the following are correct HTML code for creating a hyperlink?

  1. <a>https://www.tutorialandexample.com/</a>
  2. <a url="https://www.tutorialandexample.com/">Tutorial and Example</a>
  3. <a"https://www.tutorialandexample.com/">Tutorial and Example</a>
  4. <a href="https://www.tutorialandexample.com/"> Tutorial and Example</a>
Answer: d. <a href="https://www.tutorialandexample.com/"> Tutorial and Example</a> Explanation: <a> tag is used to describe the hyperlink, which is used to link different pages in HTML. "href" is the attribute of <a> element, which is used to specify the link's target.

13) What is the correct HTML code for opening a link in a new tab or new browser window?

  1. <a href="url" target="new">
  2. <a href="url" target="_blank">
  3. Both (a) and (b)
  4. None of the above
Answer: b. <a href="url" target="_blank"> Explanation: target attribute is used to inform the browser to open the link in the new tab. _blank is assigned to target attribute which informs the browser to open link in the new tab or window, based on the default settings of browser.

14) Which amongst the following is the correct HTML code for creating a bulleted list?

  1. <list>
  2. <blist>
  3. <ol>
  4. <ul>
Answer: d. <ul> Explanation: The <ul> tag is used to specify the unordered list or the bulleted list in HTML.

15) Which amongst the following is the correct HTML code for creating an ordered list?

  1. <ol>
  2. <olist>
  3. <ul>
  4. None of the above
Answer: a. <ol> Explanation: The <ol> tag is used to specify the ordered list in HTML i.e., in numbered formation. This ordered list can be numeric or alphabetic.

16) Which among the following tag is used for making text italic in HTML?

  1. <italic>
  2. <i>
  3. <I>
  4. None of the above
Answer: b. <i> Explanation: The <i> tag is used to show the text in italic format.

17) Which among the following is the correct HTML code for inserting an image?

  1. <image alt="SampleImage">image.gif</image>
  2. <img href="image.gif" alt= "SampleImage">
  3. <image src="image.gif" alt= "SampleImage">
  4. <img src="image.gif" alt= "SampleImage">
Answer: d. <img src="image.gif" alt= "SampleImage"> Explanation: The <img> tag is used to insert an image in a HTML page. The <img> tag has two major attributes: src (specifies the path to the image) and alt (specifies the alternate name for the image in case the image is not displayed).

18) Which amongst the following is the correct doctype for HTML?

  1. <Doctype HTML>
  2. <\Doctype html>
  3. <Doctype>
  4. <!DOCTYPE html>
Answer: d. <!DOCTYPE html> Explanation: <!DOCTYPE html> is not a tag or element; it is an instruction to the browser about the type of document. It is used to tell the browser the version of HTML used in the document.

19) What is an <input> tag?

  1. a format tag
  2. an empty tag
  3. All of the above
  4. None of the above
Answer: b. an empty tag Explanation: The <input> tag in HTML is used to describe an input field in which the user can enter data. The <input> tag is the most important tag in the form element.

20) In HTML, what is the role of the <aside> element?

  1. Content aside from the page content
  2. The ASCII character-set; to send information between computers on the Internet
  3. A navigation list to be shown at the left side of the page
  4. None of the above
Answer: a. Content aside from the page content Explanation: The <aside> tag is used to display some of the content in the HTML document aside from the content it is positioned on. The <aside> tag is usually seen as a sidebar in a HTML document.

21) Which amongst the following are the attributes of <input> tag in HTML?

  1. Type
  2. Name
  3. Max
  4. All of the above
Answer: d. All of the above Explanation: The <input> tag has various attributes. The "type" attribute is used to define the type of input, i.e., text, password and so on. The "name" attribute is used to define the name of the element, and the "max" attribute is used to define the maximum number of characters.

22) What are the empty elements in HTML?

  1. There is no such element as an empty element.
  2. Empty elements are elements with no data.
  3. Empty elements are elements that are not valid in HTML.
  4. None of the above
Answer: b. Empty elements are elements with no data. Explanation: The elements that don't have any content in themselves and do not have an end tag in HTML are called Empty Elements.

23) Which amongst the following is the subset of HTML?

  1. SGML
  2. SGMT
  3. SGMD
  4. None of the above
Answer: a. SGML Explanation: SGML is an acronym for Standard Generalized Markup Language. It is a language that is used for defining Markup Languages. HTML is one of its applications.

24) Which amongst the following tags is used to make the text underlined?

  1. <ud>
  2. <ol>
  3. <ul>
  4. <u>
Answer: d. <u> Explanation: The <u> tag is used to make the text underlined in HTML. It is generally used to highlight a word or sentence in a HTML document.

25) Tags is HTML are enclosed in:

  1. < and >
  2. " and "
  3. ? and ?
  4. { and }
Answer: a. < and > Explanation: All the tags in HTML are enclosed in angle brackets < and >.

26) Why is <hr> tag used in HTML?

  1. Vertical ruler
  2. Horizontal ruler
  3. New line
  4. None of the above
Answer: b. Horizontal ruler Explanation: The <hr> tag in HTML is for horizontal rule. It is used to insert a horizontal rule or a thematic break in an HTML page in order to divide or separate the HTML document sections. The <hr> tag is an empty tag or singleton tag, which means it does not require an end tag.

27) What is meant by "Character Encoding"?

  1. A method that represents characters in numbers
  2. A method that represents numbers in characters
  3. A method that converts bytes into characters
  4. None of the above
Answer: c. A method that converts bytes into characters Explanation: "Character Encoding" in HTML is used to convert bytes into characters. In order to display an HTML document properly, proper Character Encoding must be chosen.

28) What is meant by "Singleton Tags" in HTML?

  1. Elements that do not have a closing tag
  2. Elements that can only take single values
  3. Elements that must appear as pairs
  4. None of the above
Answer: a. Elements that do not have a closing tag. Explanation: "Singleton Tags" are the tags that do not need a closing tag. They are also called "void tags." They are only used with "attribute only" tags in HTML. Some examples of "Singleton Tags" are <br>, <hr>, <img>, <command>, and so on.

29) What amongst the following is not a Singleton Tag?

  1. <img>
  2. <br>
  3. <hr>
  4. <strong>
Answer: d. <strong> Explanation: The <strong> tag is not a Singleton Tag in HTML as it requires a closing tag.

30) What is the main difference between Elements and Tags in HTML?

  1. Tags are just opening and closing entities; element includes an opening, closing and the content.
  2. Tags include opening, closing, and the content; elements are just opening and closing entities.
  3. There is no difference between elements and tags.
  4. None of the above
Answer: a. Tags are just opening and closing entities; element includes an opening, closing and the content. Explanation: The elements in HTML consist of the beginning tag, attributes of the tags, end tag and everything that comes in between. However, the tags in HTML are just the beginning tag and end tag.

31) What is meant by an Anchor tag in HTML?

  1. It is used to open a URL in a new tab.
  2. It is used to link two sections or two web pages.
  3. There is no such thing as an Anchor tag in HTML.
  4. None of the above
Answer: b. It is used to link two sections or two web pages. Explanation: The anchor tag in HTML creates a link between two sections or two web pages. This tag contains three parts that are href attribute, name attribute, and target attribute.

32) Which amongst the following is the correct method of inserting a comment in HTML?

  1. <!--Sample-->
  2. <--Sample-->
  3. <!--Sample--!>
  4. None of the above
Answer: a. <!--Sample--> Explanation: In HTML, the comment tag begins with <!-- ….. --> and in between these symbols are the comment inserted.

33) Which element is used to put a scrolling text in a web page?

  1. <marquee>
  2. <scroll>
  3. <scrolltext>
  4. None of the above
Answer: a.<marquee> Explanation: The <marquee> tag in HTML is used to display a scrolling piece of tag either horizontally or vertically across the screen in a HTML document.

34) Which amongst the following is the correct HTML code for putting a background image in a HTML document?

  1. <body background= "image.gif">
  2. <image background= "image.gif">
  3. <background>"image.gif"</background>
  4. None of the above
Answer: a. <body background= "image.gif"> Explanation: In HTML, the background attribute is inserted in tag. It is followed by the place where the image is placed in the system.

35) Which amongst the following browser supports HTML5?

  1. Google Chrome
  2. Apple Safari
  3. Mozilla Firefox
  4. All of the above
Answer: d. All of the above Explanation: HTML5 is supported by Google Chrome, Apple Safari, Mozilla Firefox, and Opera.

36) Which amongst the following is a Block level element in HTML?

  1. <div>
  2. <p>
  3. <img>
  4. All of the above
Answer: d. All of the above Explanation: In HTML, block-level elements are the elements that start in a new line, such as a paragraph. It makes use of the complete width of the page or container in an HTML document.

37) Which amongst the following is used to list elements in HTML?

  1. <ol>
  2. <ul>
  3. <dl>
  4. All of the above
Answer: d. All of the above Explanation: The <ol> tag in HTML is used to create an ordered list, the <ul> tag is used to create an unordered list or a bulleted list, and the <dl> tag is used to create a description list. All of these tags are list elements in HTML.

38) What is meant by XHTML?

  1. Extensible hyper text markup language
  2. Extensible markup language
  3. Extensive markup language
  4. Extensive hyper text markup language
Answer: a. Extensible hyper text markup language Explanation: XHTML is a part of XML markup languages. XHTML is HTML defined as an XML application. All the commonly used browsers support it.

39) Which amongst the following options are the elements of <table> in HTML?

  1. <table><trow><td>
  2. <table><tr><tt>
  3. <table><body><td>
  4. <table><tr><td>
Answer: d. <table><tr><td> Explanation: In HTML, the table are used to arrange data into rows and columns. The <tr> tag is used to describe the table row and the <td> tag is used to describe the table data or cell.

40) Which amongst the following are the correct code for making a checkbox in HTML?

  1. <input type = "check">
  2. <checkbox>"content"</checkbox>
  3. <check>
  4. <input type = "checkbox">
Answer: d. <input type = "checkbox"> Explanation: The <input type="checkbox"> describes a checkbox in HTML.

41) Which amongst the following is the correct HTML code for creating a dropdown list?

  1. <input type= "dropdown">
  2. <input type= "list">
  3. <input type= "drop">
  4. <select>
Answer: d. <select> Explanation: The <select> element is responsible for creating used to a drop-down list in HTML. The <select> element is usually used in a form when the user input has to be collected.

42) What is <iframe> tag used for?

  1. To display a web page within a web page.
  2. To specify an inline frame.
  3. Both (a) and (b)
  4. None of the above
Answer: c. Both (a) and (b) Explanation: The <iframe> tag is used to embed another document within the current HTML document.

43) Which amongst the following tag is used to specify the title of a web page in HTML?

  1. <head>
  2. <title>
  3. <t>
  4. None of the above
Answer: b. <title> Explanation: The <title> tag in HTML is used to specify the title of the HTML document. This tag is a required tag. It defines the title in the browser toolbar and displays the page's title in Search- engine results.

44) Which tag is used to describe the footer of a document or a section in an HTML document?

  1. <bottom>
  2. <section>
  3. <footer>
  4. None of the above
Answer: c. <footer> Explanation: The <footer> tag is responsible for the footer of an HTML document or a section in a document. The <footer> usually contains contact information, related documents and so on. There can be several footers in a single HTML document.

45) For which purpose is <canvas> element used in HTML?

  1. To create draggable elements.
  2. To draw graphics
  3. To manipulate data in MySQL.
  4. To display database records.
Answer: b. To draw graphics Explanation: The <canvas> tag is responsible for drawing graphics, on the fly, via scripting (usually JavaScript). The <canvas> tag is transparent and is only a container for graphics; you must use a script to draw the graphics.

46) Which amongst the following type is used to define a slider control?

  1. Range
  2. Search
  3. Slider
  4. None of the above
Answer: a. Range Explanation: A range in the slider lets the user to control the values, i.e., maximum and minimum slider. Various types of sliders can be used in an HTML document, such as default, square, round, and image sliders.

47) Which amongst the following HTML element is used to describe the navigation links?

  1. <navigation>
  2. <navigate>
  3. <nav>
  4. None of the above
Answer: c. <nav> Explanation: The <nav> tag is used to describe the navigation links between major blocks in a HTML document.

48) Which amongst the following HTML tag is used to emphasize a text?

  1. <i>
  2. <b>
  3. <em>
  4. None of the above
Answer: c. <em> Explanation: To put major emphasis on some text in an HTML document, the <em> tag is used. This tag specifies to the user that this line or word is important. Generally, the text inside this tag is displayed in italic format.

49) Which amongst the following is the correct symbol used at the beginning of an HREF text?

  1. $
  2. &
  3. <
  4. #
Answer: d. # Explanation: The HREF is prefaced with the "#" symbol in HTML.

50) Which amongst the following is correct HTML code for creating colorful text in a HTML document?

  1. <font color = "COLOR">
  2. <font> "COLOR" </font>
  3. <color>"red"</color>
  4. None of the above
Answer: a. <font color = "COLOR"> Explanation: In HTML, the correct code for creating a colorful text in a HTML document is to use the <font>, however, <font> tag is no more supported in the newest HTML update, i.e., HTML5. For creating colorful text, the style attribute is used like this: <p style="color:red">SAMPLE PARAGRAPH</p>

51) Which amongst the following is the attribute that is used to add styles to an element in HTML such as color, font, and so on?

  1. Dir
  2. Style
  3. Color
  4. None of the above
Answer: b. Style Explanation: Style attribute specifies an inline style for an element. The style attribute will override any style set globally, e.g., styles specified in the style tag or an external style sheet.

52) Which amongst the following is not a property of attribute behavior of <marquee> tag in HTML?

  1. Scroll
  2. Alternate
  3. Blur
  4. None of the above
Answer: b. Alternate Explanation: Alternate is not a property of attribute behavior of <marquee> tag in HTML.

53) Which amongst the following code is the correct one to create an E-mail link?

  1. <a Href="mailto:[email protected]">
  2. <mail Href="[email protected]">
  3. <a Href="[email protected]">
  4. None of the above
Answer: a. <a Href="mailto:[email protected]"> Explanation: In HTML, the correct code for creating an E-mail link is <a Href="mailto:[email protected]">. To create a link that opens in the user's email program (to let them send a new email), mailto: is used inside the href attribute in HTML.

54) Which amongst the following is the correct tag for defining the description data in HTML?

  1. <dd>
  2. <dl>
  3. <dr>
  4. None of the above
Answer: a. <dd> Explanation: The <dd> tag is used to define the description data in HTML. In a <dd> tag, the user can put paragraphs, line breaks, images, links, lists, and so on.

55) Which amongst the following statements is true for HTML?

  1. HTML uses Fixed Tags Defined by the Language
  2. HTML uses User defined tags
  3. HTML uses a tag that was meant only for linking
  4. None of the above
Answer: a. HTML uses Fixed Tags Defined by the Language Explanation: In HTML, the only tags that can be used is defined by the language.

56) Which of the following property can the intensity of color be described?

  1. Hue
  2. Saturation
  3. Lightness
  4. None of the above
Answer: b. Saturation Explanation: In HTML, the intensity of a color is described with the help of saturation property.