HTML MCQ

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

MCQS OF HTML

1. What does HTML stand for?


a. Hyper Transfer Text Language
b. Hypertext Markup Language
c. High-Level Text Markup Language
d. Hyperlink and Text Markup Language

2. Which HTML element is used to define the structure of an HTML document?


a. <head>
b. <body>
c. <html>
d. <doctype>

3. Which HTML tag is used for creating a hyperlink?


a. <link>
b. <a>
c. <h1>
d. <p>

4. What is the purpose of the alt attribute in an <img> element?


a. It specifies the alignment of the image.
b. It provides an alternative text description for the image.
c. It defines the image width and height.
d. It sets the image source URL.

5. Which type of list is created using the <ul> element?


a. Ordered list
b. Definition list
c. Unordered list
d. Description list

6. Which HTML element is used to define the structure of an HTML document?


a) <head>
b) <body>
c) <html>
d) <doctype>

7. What is the correct HTML element for creating a top-level heading?


a) <title>
b) <h1>
MCQS OF HTML

c) <p>
d) <a>

8. Which HTML element is used to create a list of items in a specific order?


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

9. To create a hyperlink in HTML, which element should you use?


a) <link>
b) <a>
c) <h2>
d) <p>

10.Which HTML element is used to define the main content of a web page?
a) <header>
b) <main>
c) <nav>
d) <footer>

11.What is the root element of an HTML document?


a) <body>
b) <html>
c) <head>
d) <meta>

12.Which HTML element is used to define the title of a web page?


a) <header>
b) <title>
c) <body>
d) <h1>

13.What is the purpose of the <head> element in an HTML document?


a) It defines the main content of the page.
b) It contains metadata about the page, such as the title and character
set.
c) It specifies the page's layout and design.
MCQS OF HTML

d) It creates hyperlinks to other pages.

14.Which HTML element is used to include external CSS stylesheets?


a) <style>
b) <link>
c) <div>
d) <meta>

15.What is the purpose of the <body> element in an HTML document?


a) It contains the page's content that is visible to users.
b) It defines the page's structure and layout.
c) It stores JavaScript code for interactivity.
d) It sets the background color of the page.

16.Which HTML element is used to create a top-level heading?


a) <title>
b) <h1>
c) <p>
d) <a>

17.How many levels of headings are available in HTML?


a) 3
b) 4
c) 5
d) 6

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


a) <p>
b) <h2>
c) <ul>
d) <div>

19.What is the default rendering of a heading element (<h1> to <h6>) in most web
browsers?
a) Bold text
b) Italics text
c) Underlined text
d) Uppercase text
MCQS OF HTML

20.When should you use headings in HTML?


a) To create bullet-point lists
b) To define the structure and hierarchy of content
c) To insert images on the webpage
d) To include hyperlinks

21.Which HTML tag is used to create a top-level heading?


a) <title>
b) <h1>
c) <p>
d) <a>

22.What is the purpose of the href attribute in an <a> element?


a) It specifies the hyperlink's text.
b) It sets the background color of the link.
c) It defines the target element for the link.
d) It specifies the URL of the linked resource.

23.Which attribute is used to specify the source (URL or file path) of an image in
an <img> element?
a) source
b) img-src
c) url
d) src

24.What is the primary function of the alt attribute in an <img> element?


a) It adds a border around the image.
b) It specifies the image's width and height.
c) It provides alternative text for the image.
d) It defines the image's alignment.

25.How can inline CSS styles be applied to an HTML element?


a) Using the <style> element in the <head> section.
b) By creating a separate CSS file and linking it to the HTML document.
c) Using the style attribute directly within the HTML element.
d) Through JavaScript code.

26.What does the target attribute in an <a> element control?


a) The link's URL
MCQS OF HTML

b) The element's position on the page


c) How the linked page is displayed (e.g., in a new tab)
d) The link's font size

27.Which of the following is true about block-level elements?


a) They are always displayed on a new line.
b) They can contain other block-level elements.
c) They are typically used for inline content.
d) They include elements like <a> and <span>.

28.Which HTML tag is an example of a block-level element?


a) <strong>
b) <em>
c) <div>
d) <span>

29.What is the default behavior of block-level elements in terms of width?


a) They expand to fill the available width.
b) They are limited to a fixed width.
c) They are always displayed as full-width containers.
d) They have no width by default.

30.Inline elements are typically used for:


a) Defining sections and divisions.
b) Creating lists and tables.
c) Styling text and inline content.
d) Structuring the layout of a webpage.

31.Which HTML tag is an example of an inline element?


a) <section>
b) <ul>
c) <i>
d) <p>

32.What is an HTML tag?


a) A visible element on a webpage.
b) A container that holds HTML content.
c) A set of rules for defining web content.
MCQS OF HTML

d) An HTML attribute.

33.What is an HTML element?


a) The opening and closing parts of an HTML tag.
b) A specific type of HTML content, like text or an image.
c) A single HTML tag.
d) The entire HTML document.

34.Which symbol is used to enclose HTML tags?


a) [ ]
b) { }
c) < >
d) / /

35.Which of the following represents an HTML element?


a) <h1>
b) heading
c) [h1]
d) <head>

36.In HTML, what do you call the combination of an opening tag and a closing
tag?
a) Tag pair
b) Element
c) Attribute
d) Container

37.Which HTML tag is used to insert an image into a webpage?


a) <img>
b) <image>
c) <picture>
d) <src>

38.Which attribute in the <a> tag is used to define the destination URL when
creating a hyperlink?
a) target
b) href
c) link
MCQS OF HTML

d) src

39.What is the purpose of the alt attribute in the <img> tag?


a) It specifies the alignment of the image.
b) It defines the image's width and height.
c) It provides alternative text for the image.
d) It sets the image's source URL.

40.How do you create a link that opens in a new browser window or tab?
a) Use the <target> attribute.
b) Use the new keyword in the <a> tag.
c) Set the target attribute to _blank.
d) Add the newtab class to the link.

41.Which HTML element is used to create a table?


a) <tab>
b) <table>
c) <tr>
d) <td>

42.What is the purpose of the <th> element within a table?


a) It defines a table header cell.
b) It specifies a table title.
c) It represents a table row.
d) It creates a table cell.

43.Which HTML element defines a table row?


a) <table>
b) <row>
c) <tr>
d) <td>

44.To create a table cell, you use the <td> element. What does <td> stand for?
a) Table Data
b) Text Division
c) Table Definition
d) Table Description

45.What HTML attribute is used to merge two or more table cells horizontally?
MCQS OF HTML

a) rowspan
b) colspan
c) merge
d) span

46.Which HTML element is used to create an unordered list?


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

47.What is the purpose of the <li> element in HTML lists?


a) It defines the list type (unordered or ordered).
b) It represents a list item within an ordered or unordered list.
c) It specifies the list's alignment.
d) It defines the list's width.

48.Which attribute is used to create a numbered list in HTML?


a) ordered
b) list-type
c) type
d) numbered

49.How can you create a nested list in HTML?


a) By using multiple <ul> elements
b) By nesting <ul> or <ol> elements within an <li> element
c) By adding the nested attribute to an <ol> element
d) By using the <list> element within another list

50.Which HTML element is used for a definition list, typically used for glossaries
or terms with associated descriptions?
a) <ol>
b) <ul>
c) <dl>
d) <dt>

51.What HTML element is used to create a form in a webpage?


MCQS OF HTML

a) <form>
b) <input>
c) <button>
d) <label>

52.Which HTML input type is used for a single-line text input field?
a) text
b) password
c) email
d) radio

53.What is the purpose of the <label> element in an HTML form?


a) It creates a clickable button.
b) It defines a section within the form.
c) It provides a text description for a form element.
d) It submits the form to the server.

54.How do you group related radio buttons in an HTML form?


a) Use the <input> element with type="radio" for each option.
b) Wrap them in a <select> element.
c) Use the <fieldset> element to group them.
d) Assign them the same id attribute.

55.Which HTML input type allows users to choose multiple options from a list?
a) checkbox
b) select
c) radio
d) password

56.Which HTML5 element is used to create a header section for a webpage?


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

57.What is the purpose of the <nav> element in HTML5?


a) It defines a section of content.
b) It creates a navigation menu.
MCQS OF HTML

c) It represents a sidebar.
d) It defines a footer.

58.Which HTML element is used to group together related content or create a


sidebar?
a) <aside>
b) <main>
c) <section>
d) <article>

59.What does the <main> element represent in an HTML document?


a) It defines a secondary section of content.
b) It represents the main content of the webpage.
c) It creates a footer for the page.
d) It defines a navigation menu.

60.What is the purpose of the <footer> element in HTML?


a) It defines a header section.
b) It creates a sidebar.
c) It represents the main content of the page.
d) It defines a footer for the page.

61.What does the <iframe> element in HTML stand for?


a) Inline Frame
b) Internal Frame
c) Internet Frame
d) Inline Form

62.What is the primary purpose of the <iframe> element?


a) To display images.
b) To embed external web content within a webpage.
c) To create form fields.
d) To define navigation links.

63.Which attribute specifies the source URL of the content to be displayed within
an iframe?
a) src
b) link
c) href
MCQS OF HTML

d) url

64.What does the sandbox attribute in an iframe do?


a) It allows JavaScript code execution within the iframe.
b) It restricts the iframe's access to the parent document.
c) It sets the background color of the iframe.
d) It defines the size of the iframe.

65.What attribute is used to specify the width and height of an iframe?


a) size
b) width-height
c) dimensions
d) width and height

66.Which HTML element is used to embed video content in a webpage?


a) <media>
b) <video>
c) <vsrc>
d) <play>

67.What is the purpose of the controls attribute in the <video> element?


a) It specifies the video's source URL.
b) It provides playback controls for the video player.
c) It sets the video's width and height.
d) It defines the video's autoplay behavior.

68.Which HTML attribute is used to specify alternative text for video content,
especially useful for accessibility?
a) alt
b) description
c) caption
d) poster

69.What HTML element is used to embed audio content in a webpage?


a) <audio>
b) <sound>
c) <music>
d) <audsrc>
MCQS OF HTML

70.To autoplay an audio or video element, which attribute can be used?


a) auto
b) play
c) autoplay
d) start

71.Who is making the Web standards?


a) Mozilla
b) Google
c) Microsoft
d) The world wide web consortium

72.Choose the correct HTML element to define important text


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

73.In HTML, you can embed SVG elements directly into an HTML page.
a) True
b) False

74.Which HTML attribute specifies an alternate text for an image, if the image
cannot be displayed?
a) Longdesc
b) Title
c) Alt
d) Src

75.Block elements are normally displayed without starting a new line.


a) True
b) False

76.Inline elements are normally displayed without starting a new line.


a) True
b) False
MCQS OF HTML

You might also like