MCQ on HTML Programming Basics | NIELIT ECC

Advertisement

Q11. Which tag is used to create a list item in an unordered list?
a) <list>
b) <li>
c) <item>
d) <ul>

Show Answer

Correct Answer: b) <li>
Explanation: The <li> tag is used to create a list item within an unordered list (<ul>) or an ordered list (<ol>).

Q12. What is the default alignment of text in a <p> tag?
a) Left
b) Center
c) Right
d) Justify

Show Answer

Correct Answer: a) Left
Explanation: By default, text within a <p> tag is aligned to the left. This can be changed using CSS.

Q13. How do you specify the background color of a webpage using CSS?
a) background-color: color;
b) bgcolor: color;
c) background: color;
d) color: background;

Show Answer

Correct Answer: a) background-color: color;
Explanation: To specify the background color of a webpage, you use the background-color property in CSS. The color value can be specified by name, hex code, or RGB.

Q14. Which HTML tag is used to define a section in a webpage?
a) <section>
b) <div>
c) <article>
d) Both a and b

Show Answer

Correct Answer: d) Both a and b
Explanation: Both <section> and <div> tags can be used to define sections of a webpage. <section> is typically used for thematic grouping, while <div> is used for generic container purposes.

Q15. How do you define a table header in HTML?
a) <th>
b) <header>
c) <thead>
d) <tr>

Show Answer

Correct Answer: a) <th>
Explanation: The <th> tag is used to define table headers. It makes the text bold and centers it by default.

Q16. What does the colspan attribute do in an HTML table?
a) Merges multiple rows into one
b) Defines the number of columns a cell should span
c) Defines the number of rows a cell should span
d) Sets the width of a column

Show Answer

Correct Answer: b) Defines the number of columns a cell should span
Explanation: The colspan attribute in HTML tables is used to specify the number of columns a cell should span. It allows a cell to extend across multiple columns.

Q17. How can you make a form field required in HTML?
a) required=”true”
b) required=”yes”
c) required
d) mandatory

Show Answer

Correct Answer: c) required
Explanation: To make a form field required, you use the required attribute in the input tag. It ensures the user must fill out the field before submitting the form.

Q18. What tag is used to create a comment in HTML?
a) <comment>
b) <!– comment –>
c) <!– comment –/>
d) <– comment –>

Show Answer

Correct Answer: b) <!– comment –>
Explanation: HTML comments are created using <!– comment –>. Comments are not displayed in the browser and are used to include notes in the code.

Q19. What is the purpose of the <iframe> tag in HTML?
a) To define a frame for a form
b) To include another HTML page within the current page
c) To insert an image
d) To create a navigation bar

Show Answer

Correct Answer: b) To include another HTML page within the current page
Explanation: The <iframe> tag is used to embed another HTML page within the current page. It creates an inline frame that can display content from another source.

Q20. Which HTML element is used to create a navigation bar?
a) <nav>
b) <navbar>
c) <navigation>
d) <menu>

Show Answer

Correct Answer: a) <nav>
Explanation: The <nav> element is used to define a block of navigation links. It helps in organizing navigation menus and improving accessibility.

Advertisement
error: Content is protected !!
Scroll to Top