HTML Multiple Choice Questions
Basic HTML Structure and Elements
-
Which tag defines the root of an HTML document?
-
a) <head>
-
b) <html>
-
c) <body>
-
d) <title>
Answer: b) <html>
Explanation: The
<html>tag is the root element of an HTML document, encompassing all other elements.
-
-
Which part of the HTML structure contains metadata?
-
a) <body>
-
b) <head>
-
c) <title>
-
d) <html>
Answer: b) <head>
Explanation: The
<head>section contains metadata about the HTML document, such as the title, stylesheets, scripts, and character encoding.
-
-
Which tag defines a paragraph in HTML?
-
a) <p>
-
b) <div>
-
c) <span>
-
d) <br>
Answer: a) <p>
Explanation: The
<p>tag defines a paragraph.
-
-
Which tag inserts a horizontal rule in HTML?
-
a) <hr>
-
b) <br>
-
c) <line>
-
d) <div>
Answer: a) <hr>
Explanation: The
<hr>tag defines a thematic break in the content.
-
-
Which HTML element represents a heading?
-
a) <head>
-
b) <h1> to <h6>
-
c) <header>
-
d) <title>
Answer: b) <h1> to <h6>
Explanation: The
<h1>to<h6>tags define headings with different levels of importance.
-
HTML Links and Images
-
Which tag defines a hyperlink in HTML?
-
a) <a>
-
b) <link>
-
c) <href>
-
d) <url>
Answer: a) <a>
Explanation: The
<a>tag defines a hyperlink.
-
-
Which attribute specifies the URL of a linked resource?
-
a) href
-
b) src
-
c) link
-
d) url
Answer: a) href
Explanation: The
hrefattribute specifies the URL of the linked resource.
-
-
Which tag inserts an image in an HTML page?
-
a) <img>
-
b) <image>
-
c) <picture>
-
d) <figure>
Answer: a) <img>
Explanation: The
<img>tag inserts an image in an HTML page.
-
-
Which attribute specifies the alternative text for an image?
-
a) alt
-
b) title
-
c) src
-
d) description
Answer: a) alt
Explanation: The
altattribute provides alternative text for an image, which is displayed if the image cannot be loaded or for users who cannot see images.
-
-
Which attribute specifies the width of an image?
-
a) width
-
b) size
-
c) dimensions
-
d) imagewidth
Answer: a) width
Explanation: The
widthattribute specifies the width of an image.
HTML Lists
-
Which tag defines an unordered list in HTML?
-
a) <ul>
-
b) <ol>
-
c) <li>
-
d) <dl>
Answer: a) <ul>
Explanation: The
<ul>tag defines an unordered list.
2. Which tag defines an ordered list in HTML?
-
a) <ul>
-
b) <ol>
-
c) <li>
-
d) <dl>
Answer: b) <ol>
Explanation: The
<ol>tag defines an ordered list.
3. Which tag defines a list item in HTML?
-
a) <ul>
-
b) <ol>
-
c) <li>
-
d) <dl>
Answer: c) <li>
Explanation: The
<li>tag defines a list item.
HTML Tables
-
Which tag defines a table in HTML?
-
a) <table>
-
b) <tr>
-
c) <td>
-
d) <th>
Answer: a) <table>
Explanation: The
<table>tag defines a table.
2. Which tag defines a table row in HTML?
-
a) <table>
-
b) <tr>
-
c) <td>
-
d) <th>
Answer: b) <tr>
Explanation: The
<tr>tag defines a table row.
3. Which tag defines a table header cell in HTML?
-
a) <table>
-
b) <tr>
-
c) <td>
-
d) <th>
Answer: d) <th>
Explanation: The
<th>tag defines a table header cell.
HTML Forms
-
Which tag defines a form in HTML?
-
a) <form>
-
b) <input>
-
c) <label>
-
d) <fieldset>
Answer: a) <form>
Explanation: The
<form>tag defines a form for user input.
-
Which input type creates a text field?
-
a) text
-
b) input
-
c) field
-
d) textbox
Answer: a) text
Explanation: The
textinput type creates a text field.
-
Which input type creates a submit button?
-
a) submit
-
b) button
-
c) send
-
d) input
Answer: a) submit
Explanation: The
submitinput type creates a submit button.
-
Which input type creates a reset button?
-
a) reset
-
b) button
-
c) clear
-
d) refresh
Answer: a) reset
Explanation: The
resetinput type creates a reset button.
HTML Semantics
-
Which HTML element represents the main content of a document?
-
a) <header>
-
b) <nav>
-
c) <main>
-
d) <article>
Answer: c) <main>
Explanation: The
<main>element represents the main content of a document.
-
Which HTML element represents a section in a document?
-
a) <div>
-
b) <section>
-
c) <article>
-
d) <aside>
Answer: b) <section>
Explanation: The
<section>element represents a section in a document.
-
Which HTML element represents a footer for a document or section?
-
a) <footer>
-
b) <head>
-
c) <bottom>
-
d) <end>
Answer: a) <footer>
Explanation: The
<footer>element represents a footer for a document or section.
-
Which HTML element represents a navigation section?
-
a) <nav>
-
b) <menu>
-
c) <header>
-
d) <section>
Answer: a) <nav>
Explanation: The
<nav>element represents a navigation section.
-
Which HTML element represents a container for generic content?
-
a) <div>
-
b) <span>
-
c) <section>
-
d) <article>
Answer: a) <div>
Explanation: The
<div>element represents a container for generic content.