HTML Interview Questions & Answers for Web Developers
HTML MCQ (Multiple Choice Questions)
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
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
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>
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
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
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”
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
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
Answer: d
9. In which part of the HTML metadata is contained?
a) head tag
b) title tag
c) html tag
d) body tag
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>
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>
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) <…….!>
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.
13. Which of the following elements in HTML5 defines video or movie content?
a) <video>
b) <movie>
c) <audio>
d) <media>
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
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 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>
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.
16. Which element is used for or styling HTML5 layout?
a) CSS
b) jQuery
c) JavaScript
d) PHP
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.
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” />
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.
18. HTML is a subset of ___________
a) SGMT
b) SGML
c) SGME
d) XHTML
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) \
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>
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>
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”
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>
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>
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>
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>
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
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:enquiry@sanfoundry.com">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” />
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>
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
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>
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>
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”>
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>
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
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>
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>
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
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
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>
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>
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
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
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>
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=”670” height=”612” src= “https://sanfoundry.com”> </iframe>
45. Which of the following HTML element is used for canvas graphics?
a) <css>
b) <paint>
c) <canvas>
d) <graphic>
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).
Comments
Post a Comment