MCQ on HTML Programming Basics | NIELIT ECC

Advertisement

Q1. What is the correct basic structure of an HTML document?
a) <html><head><body></body></head></html>
b) <html><head></head><body></body></html>
c) <html><body><head></head></body></html>
d) <html><body><html></html></body></html>

Show Answer

Correct Answer: b) <html><head></head><body></body></html>
Explanation: The basic structure of an HTML document includes the <html> element, within which the <head> and <body> elements are nested. The <head> contains meta-information about the document, while the <body> contains the content.

Q2. Which tag is used to define a hyperlink in HTML?
a) <link>
b) <a>
c) <hyperlink>
d) <href>

Show Answer

Correct Answer: b) <a>
Explanation: The <a> tag is used to define a hyperlink in HTML. The href attribute specifies the URL of the page the link goes to.

Q3. How do you insert a CSS stylesheet into an HTML document?
a) <style src=”styles.css”>
b) <link rel=”stylesheet” type=”text/css” href=”styles.css”>
c) <css href=”styles.css”>
d) <stylesheet src=”styles.css”>

Show Answer

Correct Answer: b) <link rel=”stylesheet” type=”text/css” href=”styles.css”>
Explanation: To insert a CSS stylesheet into an HTML document, you use the <link> tag with rel=”stylesheet” and href attributes to specify the path to the CSS file.

Q4. Which HTML tag is used to display an image?
a) <pic>
b) <image>
c) <img>
d) <photo>

Show Answer

Correct Answer: c) <img>
Explanation: The <img> tag is used to display an image on a web page. The src attribute specifies the path to the image file.

Q5. What attribute is used with the <img> tag to specify an alternate text for an image?
a) alt
b) title
c) src
d) desc

Show Answer

Correct Answer: a) alt
Explanation: The alt attribute provides alternative text for an image if it cannot be displayed. This text is important for accessibility and SEO.

Q6. How do you create a table in HTML?
a) <table><row><cell></cell></row></table>
b) <table><tr><td></td></tr></table>
c) <table><tr><th></th></tr></table>
d) <table><tr><td></td></row></table>

Show Answer

Correct Answer: b) <table><tr><td></td></tr></table>
Explanation: To create a table in HTML, use the <table> tag. Inside the table, use <tr> for table rows and <td> for table cells. <th> can be used for table headers.

Q7. Which tag is used to define the structure of a form in HTML?
a) <form>
b) <input>
c) <fieldset>
d) <button>

Show Answer

Correct Answer: a) <form>
Explanation: The <form> tag is used to define the structure of a form. It encompasses all form elements such as inputs, buttons, and labels.

Q8. How can you make a text bold in HTML?
a) <bold>
b) <strong>
c) <b>
d) Both b and c

Show Answer

Correct Answer: d) Both b and c
Explanation: Both <strong> and <b> tags can be used to make text bold. The <strong> tag also indicates that the text is of strong importance, which can be beneficial for SEO and accessibility.

Q9. What is the purpose of the <meta> tag in HTML?
a) To provide metadata about the HTML document
b) To define the main content of the HTML document
c) To create hyperlinks
d) To insert images

Show Answer

Correct Answer: a) To provide metadata about the HTML document
Explanation: The <meta> tag is used to provide metadata about the HTML document, such as the character set, author, and description.

Q10. How do you create a new line in HTML?
a) <br>
b) <newline>
c) <break>
d) <nl>

Show Answer

Correct Answer: a) <br>
Explanation: The <br> tag is used to create a line break within text. It forces the text following it to appear on a new line.

Advertisement
1 23 ... 10» Next
error: Content is protected !!
Scroll to Top