Q61. How do you specify a style for a specific HTML element using an ID?
a) #id { style properties }
b) .id { style properties }
c) id { style properties }
d) element#id { style properties }
Show Answer
Correct Answer: a) #id { style properties }
Explanation: To apply a style to a specific HTML element using an ID, you use the #id selector in CSS, where id is the ID of the element.
Q62. What is the function of the action attribute in an HTML form?
a) Defines the URL to send the form data to
b) Specifies the form’s appearance
c) Sets the form’s method of data submission
d) Creates form input fields
Show Answer
Correct Answer: a) Defines the URL to send the form data to
Explanation: The action attribute specifies the URL of the server-side script or endpoint where the form data will be sent for processing.
Q63. How do you add a comment in HTML?
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 added using <!– This is a comment –>. Comments are not displayed in the browser and are used for notes or explanations within the code.
Q64. Which HTML tag is used to define a hyperlink?
a) <hyperlink>
b) <a>
c) <link>
d) <url>
Show Answer
Correct Answer: b) <a>
Explanation: The <a> tag is used to define a hyperlink, allowing users to navigate to another webpage or URL when clicked.
Q65. What is the default alignment of text in an HTML document?
a) Center
b) Right
c) Left
d) Justify
Show Answer
Correct Answer: c) Left
Explanation: By default, text in an HTML document is aligned to the left. This can be changed using the text-align property in CSS.
Q66. How do you create a new HTML element that will not affect the layout of the page?
a) <div>
b) <span>
c) <header>
d) <section>
Show Answer
Correct Answer: b) <span>
Explanation: The <span> tag creates an inline container that does not affect the layout of the page. It is often used for styling a specific portion of text.
Q67. Which attribute specifies the width of an HTML element?
a) width
b) size
c) length
d) height
Show Answer
Correct Answer: a) width
Explanation: The width attribute specifies the width of an HTML element. It can be used with elements like <img>, <table>, and <input>.
Q68. How do you make text bold in HTML?
a) <strong>
b) <bold>
c) <b>
d) Both a) and c)
Show Answer
Correct Answer: d) Both a) and c)
Explanation: You can make text bold using either the <strong> tag, which also emphasizes the text, or the <b> tag, which simply styles the text as bold without adding emphasis.
Q69. How do you add a background color to an HTML element using CSS?
a) background-color: color;
b) color: background;
c) bgcolor: color;
d) background: color;
Show Answer
Correct Answer: a) background-color: color;
Explanation: To add a background color to an HTML element using CSS, you use the background-color property. This property sets the color of the element’s background.
Q70. What is the purpose of the <meta> tag in HTML?
a) Provides metadata about the HTML document
b) Defines the main content of the document
c) Creates a hyperlink
d) Sets the page title
Show Answer
Correct Answer: a) Provides metadata about the HTML document
Explanation: The <meta> tag provides metadata about the HTML document, such as character encoding, author information, and viewport settings.