HTML Online Test - MCQ Questions

Welcome to the HTML Online Test! We will present 35 MCQs (Multiple-Choice Questions) to test your knowledge of the HTML basics and advanced HTML concepts.

You can select the correct answer for each question and submit the test. You will get your online test score after finishing the complete test.

1. What does HTML stand for?

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

2. Which HTML element is used to define important text?

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

3. Which HTML attribute specifies an alternate text for an image, if the image cannot be displayed?

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

4. How can you make a numbered list?

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

5. Which HTML element defines the title of a document?

a) <meta>
b) <title>
c) <head>
d) <header>

6. Which doctype is correct for HTML5?

a) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
b) <!DOCTYPE html>
c) <!DOCTYPE HTML5>
d) <!HTML>

7. Which HTML element is used to specify a footer for a document or section?

a) <footer>
b) <bottom>
c) <header>
d) <section>

8. How do you create a hyperlink in HTML?

<a href="http://www.example.com">Visit Example</a>
a) <link>http://www.example.com</link>
b) <href>http://www.example.com</href>
c) <a href="http://www.example.com">Visit Example</a>
d) <url>http://www.example.com</url>

9. What is the purpose of the <meta> tag in HTML?

a) To store data used by web browsers to optimize rendering.
b) To link to external CSS.
c) To provide metadata about the HTML document.
d) To create sections in the document.

10. Which HTML element is used to display a scalar measurement within a known range?

a) <track>
b) <meter>
c) <measure>
d) <range>

11. Which HTML tag is used to define an image map?

a) <imgmap>
b) <map>
c) <img>
d) <area>

12. Which tag is used to define an embedded object within an HTML document?

a) <object>
b) <embed>
c) <applet>
d) <media>

13. Which element is used to define emphasized text?

a) <strong>
b) <emphasis>
c) <em>
d) <italic>

14. How do you specify that an input field must be filled out before submitting the form?

<input type="text" name="fname" required>
a) <input type="text" name="fname" required>
b) <input type="text" name="fname" mandatory>
c) <input type="text" name="fname" needed>
d) <input type="text" name="fname" fill>

15. What does the <fieldset> tag represent in an HTML form?

a) It groups related elements in a form.
b) It creates a set field in a form.
c) It specifies a command button for submitting form data.
d) It organizes the form data into tabular format.

16. What is the correct HTML element to define emphasized text?

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

17. Which HTML element represents a navigation section?

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

18. Which tag is used to define a header for a document or section?

a) <header>
b) <head>
c) <top>
d) <h1>

19. What is the function of the <aside> tag in HTML?

a) It marks additional information aside from the content it is placed in.
b) It creates a sidebar for tangentially related content.
c) Both a and b.
d) None of the above.

20. How to create a checkbox in HTML?

<input type="checkbox" name="vehicle1" value="Bike">
a) <input type="check" name="vehicle1" value="Bike">
b) <check>vehicle1</check>
c) <input type="checkbox" name="vehicle1" value="Bike">
d) <checkbox>vehicle1</checkbox>

21. What element is used to define inline frames?

a) <frame>
b) <iframe>
c) <frameset>
d) <inlineframe>

22. Which HTML element is used for creating a drop-down list?

a) <list>
b) <select>
c) <dropdown>
d) <option>

23. Which tag is used to define a part of text in an alternate voice or mood?

a) <voice>
b) <sound>
c) <mood>
d) <mark>

24. Which attribute is used to specify the URL of an external script file?

a) src
b) url
c) link
d) href

25. Which HTML element defines superscripted text?

a) <sup>
b) <sub>
c) <upper>
d) <top>

26. What is the correct HTML5 element for playing video files?

<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
a) <media>
b) <video>
c) <stream>
d) <movie>

27. How do you serve a different video file depending on the user's browser using the <i><video></i> element?

<video controls>
<source src="video.webm" type="video/webm">
<source src="video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
a) Use multiple <source> tags within a <video> tag
b) Specify different video URLs in the <video> tag's src attribute
c) Use the <object> tag
d) Use JavaScript to dynamically load the video file

28. Which attribute in HTML5 is used to specify that the audio/video will start playing as soon as it is ready, without waiting for the entire file to download?

<video autoplay>
<source src="movie.mp4" type="video/mp4">
</video>
a) auto-download
b) autoplay
c) auto-start
d) auto-run

29. In HTML5, which attribute should be used to specify that video controls should not be displayed?

<video controls>
<source src="movie.mp4" type="video/mp4">
</video>
a) nocontrols
b) hide-controls
c) controls="false"
d) Remove the controls attribute

30. What does the <i>datalist</i> element do in conjunction with an <i><input></i> element?

<input list="browsers" name="browser">
<datalist id="browsers">
<option value="Chrome">
<option value="Firefox">
</datalist>
a) Creates a dropdown list suggesting options to the user as they type
b) Defines a list of pre-defined options for input controls
c) Provides a list of data for scripts to use
d) Connects input fields to a database

31. How do you make an HTML element draggable?

<div draggable="true">
Drag me!
</div>
a) Use the CSS drag property
b) Set the draggable attribute to "true"
c) Use a JavaScript drag and drop library
d) It's not possible to make HTML elements draggable by default

32. What is the purpose of the <i><output></i> element in HTML5?

<form oninput="result.value=parseInt(a.value)+parseInt(b.value)">
<input type="range" id="a" value="50">+
<input type="number" id="b" value="50">
<output name="result" for="a b">100</output>
</form>
a) To display the result of a calculation
b) To store data temporarily
c) To enhance graphical output
d) To debug JavaScript code

33. Which HTML5 element is specifically used for marking up a piece of computer code?

<code>console.log("Hello World!");</code>
a) <code>
b) <pre>
c) <kbd>
d) <samp>

34. Which HTML element is best for marking up a user input?

Type your name: <kbd>John Doe</kbd>
a) <code>
b) <var>
c) <kbd>
d) <input>

35. What is the correct way to apply a shadow DOM encapsulation to a web component?

<template id="my-component">
<style>
:host {
    display: block;
    shadow-dom: open;
}
</style>
<div>Hello Shadow DOM</div>
</template>
a) Use the shadow-dom: open; style inside a component
b) Instantiate the shadow DOM using JavaScript with attachShadow({ mode: 'open' })
c) Define a shadow attribute in HTML
d) Use the <shadow> element

Comments