MCQ on HTML Programming Basics | NIELIT ECC

Advertisement

Q41. What does the title attribute do in an HTML tag?
a) Provides a tooltip when the mouse hovers over the element
b) Specifies the title of the document
c) Sets the color of the text
d) Defines the alignment of the text

Show Answer

Correct Answer: a) Provides a tooltip when the mouse hovers over the element
Explanation: The title attribute provides additional information about an element. When a user hovers over the element, a tooltip with the value of the title attribute is displayed.

Q42. How do you specify the width of an HTML table?
a) width=”number”
b) table-width=”number”
c) width: number;
d) table-style=”width: number;”

Show Answer

Correct Answer: a) width=”number”
Explanation: The width attribute is used directly in the <table> tag to specify the width of the table. It can be defined in pixels or as a percentage of the parent element.

Q43. How do you create a radio button input in HTML?
a) <input type=”radio”>
b) <radio>
c) <input type=”button”>
d) <button type=”radio”>

Show Answer

Correct Answer: a) <input type=”radio”>
Explanation: To create a radio button input, use the <input> tag with type=”radio”. Radio buttons are used to select one option from a set of choices.

Q44. What is the default display value for a <div> element?
a) Inline
b) Block
c) None
d) Flex

Show Answer

Correct Answer: b) Block
Explanation: The default display value for a <div> element is block, which means it occupies the full width available and starts on a new line.

Q45. Which tag is used to define a dropdown list in HTML?
a) <select>
b) <list>
c) <dropdown>
d) <option>

Show Answer

Correct Answer: a) <select>
Explanation: The <select> tag is used to define a drop-down list in HTML. The <option> tags are used inside <select> to specify the items in the list.

Q46. What attribute is used to specify an image’s source in HTML?
a) src
b) href
c) alt
d) title

Show Answer

Correct Answer: a) src
Explanation: The src attribute specifies the source URL of an image in the <img> tag. It defines where the image file is located.

Q47. How do you create a hyperlink that opens in a new tab?
a) <a href=”url” target=”_blank”>
b) <a href=”url” newtab>
c) <a href=”url” target=”new”>
d) <a href=”url” target=”_self”>

Show Answer

Correct Answer: a) <a href=”url” target=”_blank”>
Explanation: To create a hyperlink that opens in a new tab, use the target=”_blank” attribute in the <a> tag.

Q48. How do you define a border for an HTML table?
a) border: number;
b) table-border: number;
c) border-width: number;
d) border-style: number;

Show Answer

Correct Answer: a) border: number;
Explanation: To define a border for an HTML table, use the border attribute in the <table> tag. This sets the width of the table border in pixels.

Q49. What does the class attribute do in HTML?
a) Defines the HTML tag
b) Specifies a CSS class to apply styles
c) Specifies the type of input
d) Provides additional information about the element

Show Answer

Correct Answer: b) Specifies a CSS class to apply styles
Explanation: The class attribute is used to specify a CSS class for an HTML element. This class can be used to apply styles defined in a CSS stylesheet.

Q50. How do you include comments in an HTML document?
a) <!– This is a comment –>
b) /* This is a comment */
c) — This is a comment —
d) /* This is a comment */

Show Answer

Correct Answer: a) <!– This is a comment –>
Explanation: HTML comments are included using <!– This is a comment –>. Comments are not displayed in the browser and are used for notes or explanations within the code.

Advertisement
« Prev1 ... 34 5 67 ... 10» Next
error: Content is protected !!
Scroll to Top