HTML MCQ (Multiple Choice Questions)

Here are 1000 HTML MCQ (Chapterwise).

1. What is HTML?
a) HTML describes the structure of a webpage
b) HTML is the standard markup language mainly used to create web pages
c) HTML consists of a set of elements that helps the browser how to view the content
d) All of the mentioned
View Answer

Answer: d
Explanation: HTML is the standard markup language mainly used to create web pages. HTML describes the structure and layout of a webpage. HTML consists of a series of elements that helps the browser how to display content easily.

2. Who is the father of HTML?
a) Rasmus Lerdorf
b) Tim Berners-Lee
c) Brendan Eich
d) Sergey Brin
View Answer

Answer: b
Explanation: Timothy John Berners-Lee (TimBL) is known as the father of HTML. He is a British computer scientist, best known as the inventor of the World Wide Web.

3. HTML stands for __________
a) HyperText Markup Language
b) HyperText Machine Language
c) HyperText Marking Language
d) HighText Marking Language
View Answer

Answer: a
Explanation: HTML stands for “HyperText Markup Language”. HTML is the standard markup language mainly used to design and create web pages and web applications.

4. What is the correct syntax of doctype in HTML5?
a) </doctype html>
b) <doctype html>
c) <doctype html!>
d) <!doctype html>
View Answer

Answer: d
Explanation: The correct syntax of HTML5 doctype is <!doctype html>, doctype is the very first thing to write in HTML5. <!doctype html> or <!DOCTYPE HTML> both are same because ‘doctype’ keyword is not case sensitive.

5. Which of the following is used to read an HTML page and render it?
a) Web server
b) Web network
c) Web browser
d) Web matrix
View Answer

Answer: c
Explanation: A web browser (commonly referred to as a browser) is a software application for retrieving, presenting and traversing information resources on the World Wide Web. A web server process, store and display output to the client as per their request. Web matrix is a discontinued cloud-connected website builder and HTML editor for Windows.
advertisement
advertisement

6. Which of the following is not a difference between HTML and XHTML?
a) Charset in both html and xhtml is “text/html”
b) Tags and attributes are case-insensitive in HTML but not in XHTML
c) Special characters must be escaped using character entities in XHTML unlike HTML
d) Charset in html is “text/html” where as in xhtml it is “application/xml+xhtml”
View Answer

Answer: a
Explanation: HTML is case insensitive while XHTML is case sensitive. In XHTML, special characters can be escaped using character entites but not in HTML. Charset in HTML is “text/html” where as it is “application/xml+xhtml” for XHTML.

7. Which of the following tag is used for inserting the largest heading in HTML?
a) head
b) <h1>
c) <h6>
d) heading
View Answer

Answer: b
Explanation: Headings in HTML starts from <h1> to <h6> in which <h1> heading is the largest one and <h6> is smallest one among those. The heading tags are <h1> <h2> <h3> <h4> <h5> and <h6> that are used for the creations of headings.

8. What is DOM in HTML?
a) Language dependent application programming
b) Hierarchy of objects in ASP.NET
c) Application programming interface
d) Convention for representing and interacting with objects in html documents
View Answer

Answer: d
Explanation: The Document Object Model is a cross-platform and language-independent application programming interface that treats an HTML, XHTML, or XML document as a tree structure. A document can be viewed as a logical tree with help of DOM Model.

9. In which part of the HTML metadata is contained?
a) head tag
b) title tag
c) html tag
d) body tag
View Answer

Answer: a
Explanation: Metadata is information about data. The meta tag provides metadata/meta information about the HTML document. Metadata will not be displayed on the page. Metadata is present in head. The body tag defines document’s body. A title tag is an HTML element which specifies the title of a web page.

10. Which element is used to get highlighted text in HTML5?
a) <u>
b) <mark>
c) <highlight>
d) <b>
View Answer

Answer: b
Explanation: The <mark> element is used to highlight a section of text. It is useful for quoting a text or if one wants to bring attention to the text. The <b> tag is used to make text/paragraph bold. <u> tag is used to underline the text you wanted.

<p>This is the example.<mark> I like this dog. </mark></p>

Output: This is the example. I like this dog.

11. Which of the following is not a HTML5 tag?
a) <track>
b) <video>
c) <slider>
d) <source>
View Answer

Answer: c
Explanation: <video> tag is used to display video clips in HTML5. Multiple media resources for media elements is specified by <source> tag. Text track for media elements i.e. <audio> & <video> is provided by <track> tag in HTML5. There is no such thing as slider tag in HTML5.

12. How do we write comments in HTML?
a) </…….>
b) <!……>
c) </……/>
d) <…….!>
View Answer

Answer: b
Explanation: Browser ignores comment in a code. There are always two types of command i.e. single line command and multiple line command. If one wants to add a comment in code, add the text between these characters <!…..comment….>. It will not visible in the user’s browser.
advertisement

13. Which of the following elements in HTML5 defines video or movie content?
a) <video>
b) <movie>
c) <audio>
d) <media>
View Answer

Answer: a
Explanation: The media to which linked document is optimized is given by <media> tag. Before HTML5, videos could only be played with a plug-in (like flash). The HTML5 video element specifies a standard way to embed a video in a webpage. As like <video> elements, <audio> element contains additional files or streams like music, recording, etc.

14. Which of the following is not the element associated with the HTML table layout?
a) alignment
b) color
c) size
d) spanning
View Answer

Answer: b
Explanation: There are three elements in HTML table layout i.e. size, spanning and alignment. Layout type can be achieved by setting Rows elements layout attribute to Fixed or Auto. Auto attribute relies on browser compatibility whereas fixed layout relies on developer specification.

15. Which element is used for or styling HTML5 layout?
a) CSS
b) jQuery
c) JavaScript
d) PHP
View Answer

Answer: a
Explanation: For styling HTML5, CSS i.e Cascading Style Sheet is used. It is style sheet language and designed to describe presentation of its content including layouts, colors and fonts. CSS can control the layout of multiple webpages.

16. Which HTML tag is used for making character appearance bold?
a) <u>content</u>
b) <b>content</b>
c) <br>content</br>
d) <i>content</i>
View Answer

Answer: b
Explanation: By enclosing words in the tags <b>and</b> we can make characters appear bold. <i> element is for content in italics, <u> is for underlined content, <br> is for vertical breaking.

17. Which HTML tag is used to insert an image?
a) <img url=”htmllogo.jpg” />
b) <img alt=”htmllogo.jpg” />
c) <img src=”htmllogo.jpg” />
d) <img link=”htmllogo.jpg” />
View Answer

Answer: c
Explanation: In HTML, <img> tag is used to insert an image in HTML page. Image tag has two attributes (src and Alt).
–> Src attribute is used to specify the image path.
–> Alt attribute is used to specify the alternate text for the image.
advertisement

18. HTML is a subset of ___________
a) SGMT
b) SGML
c) SGME
d) XHTML
View Answer

Answer: b
Explanation: HTML is a subset of SGML. SGML (Standard Generalized Markup Language) is a standard for specifying a document markup language or tag set.

19. Which character is used to represent when a tag is closed in HTML?
a) #
b) !
c) /
d) \
View Answer

Answer: c
Explanation: The forward-slash (/) is used to indicate the closure of a tag within HTML.

20. Which of the following HTML code will make an image clickable?
a)

<a href="https://www.sanfoundry.com/">Sanfoundry Home Page</a>

b)

<img src="https://www.sanfoundry.com/sanfoundry-logo">
<a href="https://www.sanfoundry.com/">Sanfoundry  Home Page</a>
</img>

c)

<a href="https://www.sanfoundry.com/">Sanfoundry Home Page</a>
<img src="https://www.sanfoundry.com/sanfoundry-logo" />

d)

<a href="https://www.sanfoundry.com/"><img src="https://www.sanfoundry.com/sanfoundry-logo" /></a>
View Answer
Answer: d
Explanation: <a> tag defines a hyperlink, which is used to link from one page to another page. Suppose if we want an image to be clickable then it should go inside <a> Tag.
 
 

21. Among the following, which is the HTML paragraph tag?
a) <p>
b) <pre>
c) <hr>
d) <a>
View Answer

Answer: a
Explanation: <p> tag is used for paragraph in HTML.

22. In HTML, which attribute is used to create a link that opens in a new window tab?
a) src=”_blank”
b) alt=”_blank”
c) target=”_self”
d) target=”_blank”
View Answer

Answer: d
Explanation: Add the target=”_blank” attribute in the Anchor tag. target=”_blank” attribute makes a link open in a new window tab.

23. Which HTML element is used for short quote?
a) <em>
b) <abbr>
c) <q>
d) <blockquote>
View Answer

Answer: c
Explanation: <em> element indicates emphasis, browser will show the contents of <em> element in italic. A section which is quoted from another source is specified by <blockquote>. The <abbr> defines abbreviation. We used <q> element for shorter quote. Browser put quote around <q> element.

<p>This is a <q>black dog</q>.</p>

Output: This is a “black dog”.

24. Which of the following HTML tag is used to create an unordered list?
a) <ol>
b) <ul>
c) <li>
d) <ll>
View Answer

Answer: b
Explanation: <ul> tag is used to create the unordered list items in an HTML document. By default, unordered list items will display in a bulleted format.
Different types of unordered list Attribute Values are:

  • Disc
  • Circle
  • Square
  • None
  • Syntax: <ul> Unordered List Items </ul>

    25. Which HTML element is used for abbreviation or acronym?
    a) <abbr>
    b) <blockquote>
    c) <q>
    d) <em>
    View Answer

    Answer: a
    Explanation: <em> element indicates emphasis, browser will show the contents of <em> element in italic. We used <q> element for shorter quote. Browser put quote around <q> element. A section which is quoted from another source is specified by <blockquote>. For using, abbreviation or acronym <abbr> element is helpful. A title element is to be used with abbr.

    <p>The <abbr title=”Doctor”>Dr.</abbr> is on the way.</p>

    Output: The Dr. is on the way.

    26. Which of the following HTML tag is used to add a row in a table?
    a) <th>
    b) <td>
    c) <tr>
    d) <tt>
    View Answer

    Answer: c
    Explanation: In HTML, <tr> tag is used to create a row in the table. <th> tag is used to set the header cell of a table.

    27. What is the work of <address> element in HTML5?
    a) contains IP address
    b) contains home address
    c) contains url
    d) contains contact details for author
    View Answer

    Answer: d
    Explanation: The contact details for author of a page is specified by <address> attribute. The content is often displayed in italics,

    e.g. 
    <address>
    <a href="mailto:[email protected]">Sanfoundry</a>
    </address>

    Output:

    Sanfoundry

    28. Which of the following tag is used to create a text area in HTML Form?
    a) <textarea> </textarea>
    b) <text></text>
    c) <input type=”text” />
    d) <input type=”textarea” />
    View Answer

    Answer: a
    Explanation: The text area tag (<textarea>) is used in a form to declare a text area element. It allows the user to enter text in multiple rows.

    29. To show deleted text, which HTML element is used?
    a) <del>
    b) <em>
    c) <strong>
    d) <ins>
    View Answer

    Answer: a
    Explanation: <strong> element shows the importance of text/paragraph between it’s tags. <em> element indicates emphasis, browser will show the contents of <em> element in italic. <ins> element shows the content that has been inserted, usually it has underline. <del> element shows text that has been deleted from, usually it has a line through the content.

    <p>This is <del>not</del> for deletion </p>

    Output: This is not for deletion.

    30. What is the correct syntax of web address?
    a) port://domain.filenmae:path/scheme/prefix
    b) prefix://scheme.port:domain/filename/path
    c) path://prefix.port:domain/filename/scheme
    d) scheme://prefix.domain:port/path/filename
    View Answer

    Answer: d
    Explanation: The correct syntax for a web address is scheme://prefix.domain:port/path/filename, where scheme is for https or http, prefix is for domain like www, domain denotes domain name, port defines port number, path defines path at server, filename is for name of the document.

    31. Which tag is used to create a dropdown in HTML Form?
    a) <input>
    b) <select>
    c) <text>
    d) <textarea>
    View Answer

    Answer: b
    Explanation: <select> element is used to create a drop-down list in HTML Forms. It is mainly used to collect user input. Option tags are used within the <select> element to define available options from the drop-down list.

    32. Which tag is used to create a numbered list in HTML?
    a) <ol>
    b) <ul>
    c) <li>
    d) <ll>
    View Answer

    Answer: a
    Explanation: <ol> tag is used to create the numbered list or ordered list items in an HTML document. An ordered list can be numerical or alphabetical order. <li> tag is used to define each list item.
    Syntax: <ol> Ordered List Items </ol>

    33. How to create a checkbox in HTML Form?
    a) <input type=”text”>
    b) <input type=”textarea”>
    c) <input type=”checkbox”>
    d) <input type=”button”>
    View Answer

    Answer: c
    Explanation: <input type=”checkbox”> is used to create a checkbox in HTML Form. Checkboxes allow a user to select one or more options of a limited number of choices.

    34. How to insert Hyperlink in HTML Page?
    a)

    <a href="https://www.sanfoundry.com/1000-html-questions-answers/">HTML MCQ</a>

    b)

    <a target="https://www.sanfoundry.com/1000-html-questions-answers/" HTML Quiz />

    c)

    <a src="https://www.sanfoundry.com/1000-html-questions-answers/">HTML Test</a>

    d)

    <a>https://www.sanfoundry.com/1000-html-questions-answers/</a>
    View Answer
    Answer: a
    Explanation: An anchor tag (<a>) and href attribute are used to create a hyperlink in HTML.
     
     

    35. Which of the following extension is used to save an HTML file?
    a) .hl
    b) .h
    c) .htl
    d) .html
    View Answer

    Answer: d
    Explanation: .html or .htm extensions are used to save the HTML file.

    36. Which tag is used to create a blank line in HTML?
    a) <b>
    b) <br>
    c) <em>
    d) <a>
    View Answer

    Answer: b
    Explanation: In HTML, <br> tag is used to create a blank line. <b> tag is used to specify the bold text. <em> tag is used to define the emphasized text.

    37. Which HTML tag is used to convert the plain text into italic format?
    a) <b>
    b) <p>
    c) <i>
    d) <a>
    View Answer

    Answer: c
    Explanation: In HTML, <i> tag is used to convert the plain text into italic format.

    38. What is the use of <hr/> tag in HTML?
    a) For making content appearance italics
    b) To create vertical rule between sections
    c) To create a line break
    d) To create horizontal rule between sections
    View Answer

    Answer: d
    Explanation: To create a break between themes-such as a change of topic in a book or a new scene in a play-you can add a horizontal rule between sections using <hr/> tag

    39. Which attribute is not essential under <iframe>?
    a) frameborder
    b) width
    c) height
    d) src
    View Answer

    Answer: a
    Explanation: An iframe is equivalent to a window that has been cut into our page, it is created using <iframe> element. Src, height, width attribute are essentially used inside of this. Src attribute specifies the URL of the page which is to be shown. Height and width specify the height and width of an iframe in pixels.

    40. Which works similar to <b> element?
    a) <blockquote>
    b) <strong>
    c) <em>
    d) <i>
    View Answer

    Answer: b
    Explanation: The words are written inside <strong> can be said with strong emphasis. Browser shows contents written inside <strong> element in bold.
    Example:

    <p>1000 <strong>HTML</strong> MCQs.</p>

    Output: 1000 HTML MCQs.

    41. Which tag is used to underline the text in HTML?
    a) <p>
    b) <u>
    c) <i>
    d) <ul>
    View Answer

    Answer: b
    Explanation: In HTML, underline tag (<u>) is used to display the underlined text.
    Example: HTML stands for <u>HyperText Markup Language</u>.

    42. Which attribute specifies a unique alphanumeric identifier to be associated with an element?
    a) type
    b) article
    c) id
    d) class
    View Answer

    Answer: c
    Explanation: HTML is Hyper Text Markup Language that is used to create web pages and applications. The id attribute is most used to point to a style in a style sheet, and by JavaScript (via the HTML DOM) to manipulate the element with the specific id. Class is a name given to HTML elements that can be used by CSS and JavaScript for styling web pages. A self-contained content is called an attribute.

    43. Which of the following is an HTML specification used to add more information to HTML tags?
    a) Modifydata
    b) Minidata
    c) Macrodata
    d) Microdata
    View Answer

    Answer: d
    Explanation: The Microdata spec provides a standardized syntax for additional semantic markup to your web pages to enhance the machine readability of your web pages. The planning for distribution center operation is offered by minidata. Macrodata and Modifydata are not any terms related to HTML5.

    44. Which HTML element is used for YouTube videos?
    a) <samp>
    b) <small>
    c) <frame>
    d) <iframe>
    View Answer

    Answer: d
    Explanation: We can host our videos through YouTube and can easily embed them into our website. <iframe> tag will be used for YouTube videos.

    E.g. <iframe width=670height=612src= “https://sanfoundry.com”> </iframe>

    45. Which of the following HTML element is used for canvas graphics?
    a) <css>
    b) <paint>
    c) <canvas>
    d) <graphic>
    View Answer

    Answer: c
    Explanation: CSS i.e. Cascading Style Sheet is a scripting language. Canvas graphics are introduced in HTML5. Element used for canvas graphics is <canvas>. The HTML canvas element is used to draw graphics, on the fly, via scripting (usually JavaScript).


    Chapterwise Multiple Choice Questions on HTML

    HTML MCQ - Multiple Choice Questions and Answers

    Our 1000+ MCQs focus on all topics of the HTML subject, covering 100+ topics. This HTML MCQ will help you to prepare for exams, contests, online tests, quizzes, viva-voce, interviews, and certifications. You can practice these MCQs chapter by chapter starting from the 1st chapter or you can jump to any chapter of your choice.
    1. HTML Fundamentals
    2. HTML Markup, HTML Forms, HTML Video, HTML Audio & Other Multimedia
    3. HTML and XHTML Fundamentals
    4. HTML Fonts, Tags and Elements
    5. HTML Images & Web Page Files
    6. HTML Tables, Javascript & Jquery Basics
    7. HTML Text, Links & Lists
    8. HTML Flash Videos, HTML5 Layout & Practical Information
    9. Advance HTML

    1. HTML MCQ on Fundamentals

    The section contains HTML multiple choice questions and answers on html basics and rules, web browsers, editors and ides, metadata, microdata, favicons & icons, html major themes, http overview, web servers and compatibility libraries.

  • Traditional HTML and XHTML
  • Rules of (X)HTML
  • Web Browsers
  • Choosing Editors and IDEs
  • Choosing Web Servers
  • Compatibility Libraries
  • HTML Metadata
  • HTML Microdata
  • HTML Favicons and Icons
  • Major Themes of (X)HTML
  • HTML5 Basics – 1
  • HTML5 Basics – 2
  • HTTP Overview
  • 2. Multiple Choice Questions on HTML Markup, Forms, Video, Audio & Other Multimedia

    The section contains HTML MCQ on web markup, document structures, open media effort, video and audio, canvas graphics, forms, scalable vector graphics, mime types, web storage, forms input types and its working, html5 form changes and beyond markup, html5 themes, web socket communications and minification.

  • Embracing the Reality of Web Markup
  • HTML5 Document Structure
  • HTML5 Open Media Effort
  • HTML5 Video
  • HTML5 Audio
  • HTML5 Client-Side Graphics with Canvas
  • HTML5 Form Changes
  • HTML5 Applicationn Elements & Attributes
  • HTML5 Beyond Markup
  • Major HTML5 Themes
  • HTML5 Scalable Vector Graphics (SVG)
  • HTML5 Audio and its MIME Types
  • HTML5 Forms Input Types
  • Web Storage
  • Forms & Minification
  • Web Socket Communications
  • 3. MCQ on HTML and XHTML Fundamentals

    The section contains HTML MCQs on html and xhtml elements and attributes, HTML 4.x and XHTML 1.x character entities.

  • XHTML Element Reference
  • Common Attributes Reference
  • HTML 4.x and XHTML 1.x Character Entities
  • 4. HTML MCQ on Fonts, Tags and Elements

    The section contains HTML multiple choice questions on document type definitions, semantic structures and elements, drag and drop, html fonts and geolocation API.

  • HTML Fonts
  • Document Type Definitions
  • HTML Semantic Structures and Elements
  • HTML Drag and Drop
  • HTML Geolocation API
  • 5. HTML MCQ on Images & Web Page Files

    The section contains HTML questions and answers on cache files, image optimizations, url encoding, web databases, web performance optimization, image sprites and client side templating.

  • Application Cache and Cache Manifest File
  • Optimization of Images
  • Adding Features Safely with Modernizr
  • URL Encoding
  • Web Databases
  • Using Image Sprites & Standardizing Client-Side Templating
  • Web Performance Optimization – 1
  • Web Performance Optimization – 2
  • 6. HTML MCQ on Tables, Javascript & Jquery Basics

    The section contains MCQs on HTML tables, javascript and jquery basics.

  • HTML Tables
  • Essential JavaScript and jQuery – 1
  • Essential JavaScript and jQuery – 2
  • Essential JavaScript and jQuery – 3
  • 7. HTML MCQ on Text, Links & Lists

    The section contains multiple choice questions on HTML headings, paragraphs, tags, bullets and definition lists, email links and its decoration, linking between pages and other sites.

  • HTML Headings, Paragraphs, Tags & Linking between Pages
  • Numbered, Bullet and Definition Lists
  • Linking to Other Sites, Email Links and its Decoration
  • 8. MCQ on HTML Flash Videos, HTML5 Layout & Practical Information

    The section contains HTML MCQ Questions on flash videos, html5 styling layouts using css, html5 layout elements, old browser vs new elements and search engine optimization.

  • Adding Flash Videos
  • Styling HTML5 Layout with CSS
  • HTML5 Layout Elements
  • Search Engine Optimization & Old Browser vs New Elements
  • If you would like to learn "HTML" thoroughly, you should attempt to work on the complete set of 1000+ MCQs - multiple choice questions and answers mentioned above. It will immensely help anyone trying to crack an exam or an interview.

    Wish you the best in your endeavor to learn and master HTML!

    Important Links:

    advertisement
    Manish Bhojasia - Founder & CTO at Sanfoundry
    Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

    Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.