What HTML element is used to define emphasized text?
a) <em> b) <strong> c) <b> d) <i>
Correct Answer: a) <em>
Explanation: The <em> tag is used to emphasize text, which typically renders in italic to indicate importance.
Question 02
Which HTML element is used to create a hyperlink?
a) <a> b) <link> c) <href> d) <nav>
Correct Answer: a) <a>
Explanation: The <a> tag is used to define hyperlinks in HTML, with the href attribute specifying the URL.
Question 03
Which of the following opens a link in a new tab or browser window?
a) <a href=”url” new> b) <a href=”url” window=”_blank”> c) <a href=”url” target=”_blank”> d) <a href=”url” link=”_new”>
Correct Answer: c) <a href="url" target="_blank">
Explanation: The target="_blank" attribute in the <a> tag opens the link in a new tab or window.
Question 04
Which HTML elements are used to create a table?
a) <table>, <row>, <col> b) <table>, <tr>, <td> c) <table>, <tbody>, <tfoot> d) <div>, <p>, <span>
Correct Answer: b) <table>, <tr>, <td>
Explanation: The core elements used to create a table in HTML are <table> (table), <tr> (table row), and <td> (table data/cell).
Question 05
True or False: Inline elements are normally displayed without starting a new line.
a) True b) False
Correct Answer: a) True
Explanation: Inline elements, such as <span>, do not create a new line; they only take up as much width as required by their content.
Question 06
How do you create a numbered list in HTML?
a) <ul> b) <ol> c) <list> d) <li>
Correct Answer: b) <ol>
Explanation: The <ol> tag is used to create an ordered (numbered) list in HTML.
Question 07
How do you create a bulleted list in HTML?
a) <ol> b) <ul> c) <list> d) <li>
Correct Answer: b) <ul>
Explanation: The <ul> tag is used to create an unordered (bulleted) list.
Question 08
What is the correct HTML for making a checkbox?
a) <input type=”checkbox”> b) <checkbox> c) <input checkbox=”true”> d) <input type=”check”>
Correct Answer: a) <input type="checkbox">
Explanation: The correct syntax for creating a checkbox in HTML is by using <input type="checkbox">.
Question 09
How do you make a text input field in HTML?
a) <input type=”text”> b) <textarea> c) <input text=”true”> d) <textbox>
Correct Answer: a) <input type="text">
Explanation: The <input type="text"> element is used to create a single-line text input field.
Question 10
Which HTML element is used to create a drop-down list?
a) <select> b) <dropdown> c) <option> d) <input>
Correct Answer: a) <select>
Explanation: The <select> element is used to create a drop-down list, with <option> elements defining each selectable item.
Question 11
What is the correct HTML for creating a text area?
a) <textarea> b) <input type=”text”> c) <input type=”textbox”> d) <input type=”textarea”>
Correct Answer: a) <textarea>
Explanation: The <textarea> element is used to create a multi-line text input field.
Question 12
What is the correct HTML for inserting an image?
a) <img href=”image.gif” alt=”MyImage”> b) <image src=”image.gif” alt=”MyImage”> c) <img src=”image.gif” alt=”MyImage”> d) <img link=”image.gif” text=”MyImage”>
Correct Answer: c) <img src="image.gif" alt="MyImage">
Explanation: The <img> tag is used to insert an image, with src specifying the image source and alt providing alternative text.
Question 13
What is the correct HTML for inserting a background image?
a) <body background=”background.gif”> b) <body style=”background-image:url(‘background.gif’);”> c) <body bg=”background.gif”> d) <img src=”background.gif” background>
Correct Answer: b) <body style="background-image:url('background.gif');">
Explanation: The background-image CSS property is used within the style attribute to apply a background image to an HTML element.
Question 14
True or False: An <iframe> is used to display a webpage within a webpage.
a) True b) False
Correct Answer: a) True
Explanation: The <iframe> element is used to embed another HTML page within the current page.
Question 15
True or False: Block elements are normally displayed without starting a new line.
a) True b) False
d) Type, action, enctype, method, value
Correct Answer: b) False
Explanation: Block elements, such as <div>, always start on a new line and take up the full width available.
Question 16
Which HTML attribute specifies an alternate text for an image if the image cannot be displayed?
a) Src b) Alt c) Title d) Name
Correct Answer: b) Alt
Explanation: The alt attribute provides alternative text for an image if it cannot be displayed.
Question 17
Which of the following is the correct doctype for HTML5?
a) <!DOCTYPE html> b) <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”> c) <!DOCTYPE HTML5> d) <!DOCTYPE xhtml>
Correct Answer: a) <!DOCTYPE html>
Explanation: HTML5 uses the simplified <!DOCTYPE html> declaration.
Question 18
Which HTML element is used to specify a footer?
a) <div> b) <footer> c) <section> d) <header>
Correct Answer: b) <footer>
Explanation: The <footer> element is used to define the footer section of a document or section.
Question 19
True or False: In HTML, you can embed SVG elements directly into an HTML page.
a) True b) False
Correct Answer: a) True
Explanation: SVG (Scalable Vector Graphics) can be directly embedded within HTML to create scalable images.
Question 20
Which HTML element is used to play video files?
a) <media> b) <movie> c) <video> d) <embed>
Correct Answer: c) <video>
Explanation: The <video> element is used to embed video content into a webpage.