- web.groovymark@gmail.com
- December 14, 2024
Question 01
Which HTML element is used to define a table header in a table?
a) <thead>
b) <th>
c) <tr>
d) <td>
Correct Answer: b) <th>
Explanation: The <th> element is used to define header cells in a table, which are often bold and centered.
Question 02
Which attribute of the <img> tag specifies alternative text for an image?
a) src
b) alt
c) title
d) placeholder
Correct Answer: b) alt
Explanation: The alt attribute provides alternative text for an image if it cannot be displayed.
Question 03
Which HTML element is used to define an unordered list?
a) <ol>
b) <ul>
c) <li>
d) <list>
Correct Answer: b) <ul>
Explanation: The <ul> element defines an unordered list, where items are typically marked with bullet points.
Question 04
Which HTML element is used to create a drop-down list?
a) <input type=”dropdown”>
b) <select>
c) <option>
d) <dropdown>
Correct Answer: b) <select>
Explanation: The <select> element is used to create a drop-down list in HTML, often in combination with <option> elements.
Question 05
What is the purpose of the <fieldset> element in HTML forms?
a) To group related form controls
b) To create a border around the form
c) To submit form data
d) To define default form values
Correct Answer: a) To group related form controls
Explanation: The <fieldset> element is used to group related form elements together for better structure and clarity.
Question 06
Which tag is used to define a scalar measurement within a known range in HTML?
a) <meter>
b) <range>
c) <progress>
d) <measure>
Correct Answer: a) <meter>
Explanation: The <meter> tag represents a scalar measurement within a known range, such as disk usage or progress percentage.
Question 07
Which attribute is used to associate a label with a form control in HTML?
a) id
b) for
c) name
d) type
Correct Answer: b) for
Explanation: The for attribute in the <label> tag is used to associate the label with a specific form element by matching the form control's id attribute.
Question 08
Which HTML attribute specifies that an input field must be filled out before submitting a form?
a) required
b) placeholder
c) autofocus
d) maxlength
Correct Answer: a) required
Explanation: The required attribute ensures that the user must complete the input field before submitting the form.
Question 09
Which <input> type is used for entering a phone number in HTML5?
a) text
b) tel
c) phone
d) number
Correct Answer: b) tel
Explanation: The <input type="tel"> is used for collecting phone numbers, ensuring the correct format for the input.
Question 10
Which HTML5 element is used to define navigation links?
a) <nav>
b) <header>
c) <footer>
d) <section>
Correct Answer: a) <nav>
Explanation: The <nav> element is used to group a set of navigation links within a webpage.
Question 11
Which HTML element defines content that is not directly related to the main content but is placed alongside it?
a) <aside>
b) <header>
c) <footer>
d) <section>
Correct Answer: a) <aside>
Explanation: The <aside> element is used for content that is related to the main content but placed separately, like a sidebar.
Question 12
How do you create a hyperlink that opens in a new browser tab or window in HTML?
a) <a href=”url” target=”window”>
b) <a href=”url” target=”_blank”>
c) <a href=”url” open=”new_tab”>
d) <a href=”url” new=”tab”>
Correct Answer: b) <a href="url" target="_blank">
Explanation: The target="_blank" attribute opens the linked document in a new tab or window.
Question 13
Which HTML5 element is used for embedding audio content on a webpage?
a) <embed>
b) <audio>
c) <sound>
d) <media>
Correct Answer: b) <audio>
Explanation: The <audio> tag is used to embed sound content, such as music or podcasts, into a webpage.
Question 14
Which HTML5 tag is used to embed video files in a webpage?
a) <media>
b) <embed>
c) <video>
d) <object>
Correct Answer: c) <video>
Explanation: The <video> tag is used to embed video content directly in a webpage, often with controls like play, pause, and volume.
Question 15
Which attribute is required in the <img> tag to display an image?
a) src
b) alt
c) title
d) href
Correct Answer: a) src
Explanation: The src attribute specifies the image source URL, and it is required to display the image.
Question 16
Which HTML5 tag specifies a self-contained composition in a document?
a) <aside>
b) <article>
c) <section>
d) <div>
Correct Answer: b) <article>
Explanation: The <article> tag defines a self-contained, independent piece of content, such as a blog post or news article.
Question 17
Which CSS selector is used to apply styles to the first child of an element?
a) :first-of-type
b) :first-child
c) :nth-child(1)
d) :only-child
Correct Answer: b) :first-child
Explanation: The :first-child selector targets the first child element of its parent in CSS.
Question 18
Which CSS selector selects elements with an attribute and specific value?
a) [attribute=value]
b) .attribute=value
c) attribute(value)
d) #attribute=value
Correct Answer: a) [attribute=value]
Explanation: The [attribute=value] selector selects elements with a specified attribute and value.
Question 19
Which CSS property is used to change the font style of an element?
a) font-family
b) font-style
c) text-style
d) font-weight
Correct Answer: b) font-style
Explanation: The font-style property is used to apply styles such as italic to the text.
Question 20
What does the z-index property control in CSS?
a) The visibility of an element
b) The stacking order of positioned elements
c) The opacity of an element
d) The width of an element
Correct Answer: b) The stacking order of positioned elements
Explanation: The z-index property controls the stacking order of elements that overlap, with higher values placing elements on top.