HTML Quiz

1. What does HTML stand for?

a) Hyper Trainer Marking Language
b) Hyper Text Marketing Language
c) Hyper Text Markup Language
d) Hyperlinking Text Marking Language

Answer:

c) Hyper Text Markup Language

Explanation:

HTML stands for Hyper Text Markup Language. It is the standard markup language for documents designed to be displayed in a web browser.

2. Which HTML tag is used to define an internal style sheet?

a) <script>
b) <style>
c) <css>
d) <link>

Answer:

b) <style>

Explanation:

The <style> tag is used to define style information for a single HTML page, making it an internal stylesheet.

3. Which HTML element is used for the largest heading?

a) <head>
b) <h6>
c) <heading>
d) <h1>

Answer:

d) <h1>

Explanation:

<h1> is used for the largest heading in HTML.

4. How can you make a numbered list in HTML?

a) <ul>
b) <ol>
c) <dl>
d) <list>

Answer:

b) <ol>

Explanation:

An ordered list (<ol>) is used to create a numbered list in HTML.

5. Which attribute is used to provide an alternate text for an image, in case the image cannot be displayed?

a) title
b) alt
c) src
d) longdesc

Answer:

b) alt

Explanation:

The alt attribute provides an alternate text for an image, if the image for some reason cannot be displayed.

6. Which element is used to define important text in HTML?

a) <important>
b) <strong>
c) <b>
d) <em>

Answer:

b) <strong>

Explanation:

The <strong> tag is used to define text with added importance in HTML, which is typically displayed as bold by default.

7. How do you create a hyperlink in HTML?

a) <link href="url">text</link>
b) <a href="url">text</a>
c) <href="url">text</href>
d) <hyperlink url="url">text</hyperlink>

Answer:

b) <a href="url">text</a>

Explanation:

The <a> tag with the href attribute is used to create hyperlinks in HTML.

8. Which tag is used to insert an image in an HTML page?

a) <img src="image.jpg">
b) <image src="image.jpg">
c) <src="image.jpg">
d) <picture="image.jpg">

Answer:

a) <img src="image.jpg">

Explanation:

The <img> tag, along with the src attribute specifying the path to the image file, is used to embed images in an HTML page.

9. What is the correct HTML tag for inserting a line break?

a) <break>
b) <lb>
c) <br>
d) <linebreak>

Answer:

c) <br>

Explanation:

The <br> tag is used in HTML to insert a line break or carriage return.

10. Which tag is used to define a table in HTML?

a) <table>
b) <tbl>
c) <tab>
d) <grid>

Answer:

a) <table>

Explanation:

The <table> tag is used to create a table in HTML.

11. Which attribute specifies a unique identifier for an HTML element?

a) class
b) id
c) type
d) name

Answer:

b) id

Explanation:

The id attribute is used to specify a unique id for an HTML element, which can be used for CSS styling and JavaScript manipulation.

12. What does the <meta> tag provide information about?

a) Metadata of the HTML document
b) External resources to be linked
c) Scripting information
d) Styling of the document

Answer:

a) Metadata of the HTML document

Explanation:

The <meta> tag provides metadata about the HTML document, such as character set, page description, keywords, author of the document, and viewport settings.

13. Which HTML tag is used to display a horizontal rule?

a) <line>
b) <hr>
c) <rule>
d) <horizontal>

Answer:

b) <hr>

Explanation:

The <hr> tag is used to create a thematic break in an HTML page, commonly displayed as a horizontal rule.

14. Which tag is used to define a dropdown list in HTML?

a) <input type="dropdown">
b) <select>
c) <list>
d) <option>

Answer:

b) <select>

Explanation:

The <select> tag, in combination with <option> tags, is used to create a dropdown list in HTML.

15. What is the purpose of the <div> tag in HTML?

a) To embed media files
b) To create a clickable button
c) To define a division or a section
d) To emphasize text

Answer:

c) To define a division or a section

Explanation:

The <div> tag is used to define a division or a section in an HTML document, often used as a container for other HTML elements for styling or layout purposes using CSS.

16. Which HTML tag is used to define a paragraph?

a) <paragraph>
b) <text>
c) <p>
d) <para>

Answer:

c) <p>

Explanation:

The <p> tag is used for defining a paragraph in HTML. It automatically applies some margin before and after itself.

17. What is the correct HTML element for playing video files?

a) <media>
b) <video>
c) <movie>
d) <film>

Answer:

b) <video>

Explanation:

The <video> element is used to embed video content in an HTML document.

18. Which of the following is NOT a valid HTML5 element?

a) <header>
b) <footer>
c) <main>
d) <blink>

Answer:

d) <blink>

Explanation:

The <blink> element is not a part of HTML5; it was a non-standard element and is now obsolete.

19. Which HTML attribute is used to define inline styles?

a) style
b) styles
c) stylesheet
d) type

Answer:

a) style

Explanation:

The style attribute is used to apply CSS styles directly to an HTML element, defining them inline.

20. How do you specify the character encoding in an HTML document?

a) <meta charset="UTF-8">
b) <meta encoding="UTF-8">
c) <html charset="UTF-8">
d) <encoding="UTF-8">

Answer:

a) <meta charset="UTF-8">

Explanation:

The <meta charset="UTF-8"> tag is used within the head section of the HTML document to specify the character encoding for the document.

21. What is the purpose of the <canvas> element in HTML5?

a) To play audio files
b) To display database records
c) To draw graphics on the fly
d) To create clickable buttons

Answer:

c) To draw graphics on the fly

Explanation:

The <canvas> element is used in HTML5 to draw graphics on a web page via scripting (usually JavaScript).

22. Which attribute is used to open a hyperlink in a new tab?

a) href="_blank"
b) target="_blank"
c) newtab="_blank"
d) link="_blank"

Answer:

b) target="_blank"

Explanation:

The target="_blank" attribute in the <a> tag is used to open the linked document in a new tab or window.

23. Which HTML element is used for specifying a footer for a document or section?

a) <bottom>
b) <footer>
c) <foot>
d) <end>

Answer:

b) <footer>

Explanation:

The <footer> element specifies a footer for a document or section, often containing information like authorship, copyright, and contact information.

24. What does the colspan attribute in a table cell specify in HTML?

a) The number of columns a cell should span
b) The color of the column
c) The spacing between columns
d) The alignment of columns

Answer:

a) The number of columns a cell should span

Explanation:

The colspan attribute in a <td> or <th> element specifies the number of columns that the cell should span.

25. Which tag is used to create a clickable checkbox in HTML?

a) <check>
b) <input type="checkbox">
c) <box>
d) <tick>

Answer:

b) <input type="checkbox">

Explanation:

The <input type="checkbox"> tag is used to create a clickable checkbox in HTML.

26. Which HTML element is used to define a section in a document?

a) <section>
b) <div>
c) <block>
d) <segment>

Answer:

a) <section>

Explanation:

The <section> tag is used to define a section in a document, typically with a thematic grouping of content and headings.

27. What is the purpose of the alt attribute for images in HTML?

a) To provide a text alternative for the image
b) To change the image's appearance
c) To specify the image source
d) To create a link to the image

Answer:

a) To provide a text alternative for the image

Explanation:

The alt attribute is used to describe the contents of an image file. It's important for accessibility and SEO.

28. Which element is used in HTML to create a form for user input?

a) <form>
b) <input>
c) <userinput>
d) <feedback>

Answer:

a) <form>

Explanation:

The <form> element is used to create an HTML form for user input which can contain various types of input elements like text fields, checkboxes, radio buttons, submit buttons, etc.

29. How can you make a list that lists the items with bullets?

a) <ul>
b) <ol>
c) <li>
d) <dl>

Answer:

a) <ul>

Explanation:

An unordered list (<ul>) is used to create a list of items marked with bullets.

30. Which tag is used to add a header in a table in HTML?

a) <thead>
b) <header>
c) <th>
d) <top>

Answer:

c) <th>

Explanation:

The <th> (table header) element is used within a table to define header cells, which typically contain bold, centered text.

31. What is the correct HTML for making a text area?

a) <input type="textarea">
b) <textarea>
c) <input type="text">
d) <textbox>

Answer:

b) <textarea>

Explanation:

The <textarea> element is used to create a multi-line text input field, allowing users to input larger amounts of text.

32. Which HTML tag is used for displaying a list item with a disc bullet point?

a) <ul style="list-style-type:disc">
b) <ol style="list-style-type:disc">
c) <list style="bullet:disc">
d) <dl style="list-style-type:disc">

Answer:

a) <ul style="list-style-type:disc">

Explanation:

An unordered list (<ul>) with the style list-style-type: disc; will display list items with a disc bullet point.

33. In HTML5, which element is used to specify independent, self-contained content?

a) <article>
b) <section>
c) <widget>
d) <container>

Answer:

a) <article>

Explanation:

The <article> element specifies independent, self-contained content in HTML5, such as a blog entry or news article.

34. Which HTML element is used to represent navigation links?

a) <navigate>
b) <nav>
c) <links>
d) <navigation>

Answer:

b) <nav>

Explanation:

The <nav> element is used to define a set of navigation links in HTML5.

35. Which HTML5 element is used for playing audio files?

a) <mp3>
b) <sound>
c) <audio>
d) <music>

Answer:

c) <audio>

Explanation:

The <audio> element is used to embed sound content in documents. It can support multiple audio formats.

36. Which attribute is used to provide a tooltip for an element in HTML?

a) alt
b) title
c) tooltip
d) description

Answer:

b) title

Explanation:

The title attribute is used to provide additional information about an element, typically displayed as a tooltip when the mouse hovers over the element.

37. What does the <aside> element represent in an HTML5 document?

a) A navigation bar
b) A section containing related links
c) Content indirectly related to the page content
d) The main content area

Answer:

c) Content indirectly related to the page content

Explanation:

The <aside> element in HTML5 is used for content that is indirectly related to the main content of the page, like a sidebar.

38. Which attribute is necessary to include in the <img> tag to make it valid HTML?

a) title
b) alt
c) href
d) source

Answer:

b) alt

Explanation:

The alt attribute is essential for image accessibility and SEO. It provides alternative text for the image if it cannot be displayed.

39. What is the role of the <link> element in HTML?

a) To create a hyperlink
b) To connect a document to an external resource
c) To display a linked document within the current document
d) To define a relationship between two documents

Answer:

b) To connect a document to an external resource

Explanation:

The <link> element is used to link the current document to an external resource, often a stylesheet.

40. Which HTML tag is used to specify a header for a group of table rows?

a) <tr>
b) <th>
c) <thead>
d) <tgroup>

Answer:

c) <thead>

Explanation:

The <thead> element is used to group header content in a table, typically containing one or more <th> elements.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top