MCQs Of Class 20: Project - Building a Personal Web Page
1. Which of the following tag is used to define the main header of an HTML document?
A) <footer>
B) <header>
C) <nav>
D) <section>
Answer: B) <header>
Explanation: The <header>
tag is used to define the header section of an HTML document, typically containing the website's navigation, logo, and title.
2. What is the correct HTML element to display a paragraph?
A) <div>
B) <p>
C) <span>
D) <section>
Answer: B) <p>
Explanation: The <p>
tag is used to define a paragraph of text in HTML.
3. How do you create a link to another page in HTML?
A) <link>
B) <a>
C) <href>
D) <url>
Answer: B) <a>
Explanation: The <a>
tag is used to create hyperlinks in HTML, with the href
attribute specifying the link's destination.
4. Which tag is used to define a list of items in HTML?
A) <ul>
B) <li>
C) <ol>
D) All of the above
Answer: D) All of the above
Explanation: <ul>
defines an unordered list, <ol>
defines an ordered list, and <li>
defines each list item in both types of lists.
5. What is the purpose of the <footer>
tag in HTML?
A) To define the navigation bar
B) To define the header section
C) To define the footer section
D) To define a form
Answer: C) To define the footer section
Explanation: The <footer>
tag is used to define the footer section, typically containing copyright information and links.
6. How do you specify the width of an image in HTML?
A) width="500px"
B) width="500"
C) img width="500"
D) <image width="500">
Answer: B) width="500"
Explanation: The width
attribute is used to specify the width of an image in HTML. The unit (like pixels) can be specified optionally.
7. Which attribute is used to add an email link in HTML?
A) href="email"
B) href="mailto:"
C) src="mailto:"
D) email="mailto:"
Answer: B) href="mailto:"
Explanation: The mailto:
protocol is used to create an email link, where users can click to open their default email client.
8. Which tag is used to define an unordered list in HTML?
A) <ul>
B) <ol>
C) <li>
D) <dl>
Answer: A) <ul>
Explanation: The <ul>
tag is used to define an unordered list in HTML.
9. How can you make a list item bold in HTML?
A) <b>
B) <strong>
C) Both A and B
D) <em>
Answer: C) Both A and B
Explanation: Both the <b>
and <strong>
tags can make text bold. However, <strong>
adds semantic meaning, indicating that the text is of strong importance.
10. What does the alt
attribute in an image tag specify?
A) The image's file path
B) The alternative text for the image
C) The size of the image
D) The background color for the image
Answer: B) The alternative text for the image
Explanation: The alt
attribute specifies alternative text for an image if it cannot be displayed, for accessibility purposes.
11. Which tag is used to create a navigation bar in HTML?
A) <header>
B) <footer>
C) <nav>
D) <section>
Answer: C) <nav>
Explanation: The <nav>
tag is used to define a navigation section of a website, typically containing links to other sections or pages.
12. What is the correct way to link an external CSS file to an HTML document?
A) <css href="styles.css">
B) <style src="styles.css">
C) <link rel="stylesheet" href="styles.css">
D) <script src="styles.css">
Answer: C) <link rel="stylesheet" href="styles.css">
Explanation: The <link>
tag with rel="stylesheet"
and the href
attribute is used to link an external CSS file to an HTML document.
13. Which of the following is used to create a section within a web page?
A) <div>
B) <section>
C) <header>
D) <footer>
Answer: B) <section>
Explanation: The <section>
tag is used to define a section of content within an HTML document, often used for grouping related content.
14. What is the correct HTML element for inserting a line break?
A) <break>
B) <br>
C) <hr>
D) <newline>
Answer: B) <br>
Explanation: The <br>
tag is used to insert a line break, breaking the text into a new line.
15. Which tag is used to define an HTML form?
A) <input>
B) <form>
C) <textarea>
D) <button>
Answer: B) <form>
Explanation: The <form>
tag is used to define a form in HTML where users can input data.
16. How do you define the heading of a page in HTML?
A) <header>
B) <h1>
C) <title>
D) <head>
Answer: B) <h1>
Explanation: The <h1>
tag is used to define the main heading of a page, which is typically the largest and most important heading.
17. Which attribute is used to specify the target window when linking to another page in HTML?
A) target="_self"
B) target="_blank"
C) window="_blank"
D) Both A and B
Answer: B) target="_blank"
Explanation: The target="_blank"
attribute opens the linked page in a new tab or window.
18. Which of the following elements is used to embed a video in HTML?
A) <audio>
B) <movie>
C) <video>
D) <media>
Answer: C) <video>
Explanation: The <video>
tag is used to embed a video file into an HTML document.
19. What does the <aside>
tag represent in HTML?
A) A sidebar content
B) A section of the main content
C) The page footer
D) The navigation menu
Answer: A) A sidebar content
Explanation: The <aside>
tag is used to define content that is tangentially related to the content around it, such as a sidebar.
20. What is the correct way to include a comment in an HTML document?
A) <!-- comment -->
B) // comment
C) /* comment */
D) # comment
Answer: A) <!-- comment -->
Explanation: HTML comments are added using the <!-- comment -->
syntax.
21. Which tag is used to add a table in HTML?
A) <table>
B) <tr>
C) <td>
D) <th>
Answer: A) <table>
Explanation: The <table>
tag is used to define a table in HTML. It is used alongside <tr>
, <td>
, and <th>
to define rows, cells, and headers.
22. How do you make text bold in HTML?
A) <bold>
B) <strong>
C) <b>
D) Both B and C
Answer: D) Both B and C
Explanation: Both the <strong>
and <b>
tags can be used to make text bold, though <strong>
also adds semantic meaning indicating importance.
23. How do you define a link to an external resource in HTML?
A) <link rel="stylesheet" href="styles.css">
B) <link src="styles.css">
C) <a href="styles.css">
D) <link href="styles.css">
Answer: A) <link rel="stylesheet" href="styles.css">
Explanation: The <link>
tag is used to define a relationship between the HTML document and an external resource, such as a CSS file.
24. What is the default alignment of text inside a paragraph in HTML?
A) Left-aligned
B) Right-aligned
C) Centered
D) Justified
Answer: A) Left-aligned
Explanation: By default, the text inside a paragraph is left-aligned in HTML.
25. Which of the following is used to create a table header?
A) <tr>
B) <td>
C) <th>
D) <table>
Answer: C) <th>
Explanation: The <th>
tag is used to define a table header, and its contents are typically displayed in bold and centered.
26. How do you insert a background color in an HTML page?
A) <background-color="red">
B) <body bgcolor="red">
C) <bgcolor="red">
D) <style> body {background-color: red;} </style>
Answer: D) <style> body {background-color: red;} </style>
Explanation: The background color can be defined using CSS within a <style>
tag, like background-color: red;
.
27. How do you create an ordered list in HTML?
A) <ul>
B) <ol>
C) <li>
D) <dl>
Answer: B) <ol>
Explanation: The <ol>
tag is used to create an ordered (numbered) list in HTML.
28. Which of the following is used to group elements in HTML?
A) <section>
B) <div>
C) <header>
D) <footer>
Answer: B) <div>
Explanation: The <div>
tag is used to group elements together, making them easier to style and manage.
29. What is the correct syntax for adding a JavaScript file to an HTML document?
A) <script href="script.js">
B) <script src="script.js"></script>
C) <js src="script.js"></js>
D) <javascript src="script.js"></javascript>
Answer: B) <script src="script.js"></script>
Explanation: The <script>
tag with the src
attribute is used to link an external JavaScript file to an HTML document.
30. Which tag is used to define a table row in HTML?
A) <td>
B) <th>
C) <tr>
D) <table>
Answer: C) <tr>
Explanation: The <tr>
tag is used to define a row in a table.
31. How do you create a line break within a paragraph in HTML?
A) <hr>
B) <br>
C) <break>
D) <linebreak>
Answer: B) <br>
Explanation: The <br>
tag creates a line break and is used to split text into a new line.
32. Which tag is used to define a form input field?
A) <input>
B) <form>
C) <textarea>
D) <button>
Answer: A) <input>
Explanation: The <input>
tag is used to create interactive controls in a form that allows the user to enter data.
33. Which of the following is used to make a website accessible to users with disabilities?
A) Using semantic HTML tags
B) Adding alt text to images
C) Providing captions for videos
D) All of the above
Answer: D) All of the above
Explanation: Accessible websites use semantic HTML tags, alt text for images, and captions for videos to improve accessibility.
34. Which of the following is a valid HTML comment?
A) <!-- This is a comment -->
B) // This is a comment
C) /* This is a comment */
D) # This is a comment
Answer: A) <!-- This is a comment -->
Explanation: In HTML, comments are enclosed within <!--
and -->
.
35. What is the purpose of the <meta>
tag in an HTML document?
A) To add a title to the page
B) To specify the character encoding
C) To define the content type
D) All of the above
Answer: D) All of the above
Explanation: The <meta>
tag provides metadata about the HTML document, such as the character encoding, author, description, and keywords.
36. How do you include a background image in HTML?
A) <image src="background.jpg">
B) <background src="background.jpg">
C) <img src="background.jpg">
D) background-image: url("background.jpg");
in CSS
Answer: D) background-image: url("background.jpg");
in CSS
Explanation: The background image is typically added using CSS with the background-image
property.
37. Which tag is used to define a table cell in HTML?
A) <tr>
B) <td>
C) <th>
D) <table>
Answer: B) <td>
Explanation: The <td>
tag is used to define a cell in a table, which contains data.
38. What does the <strong>
tag do in HTML?
A) Makes the text bold
B) Makes the text italic
C) Indicates strong importance
D) All of the above
Answer: C) Indicates strong importance
Explanation: The <strong>
tag is used to indicate that the text is of strong importance, typically making it bold.
You said:
rest 12
ChatGPT said:
ChatGPT
Here are the remaining 12 questions:
39. Which of the following tags is used to define a navigation bar in HTML?
A) <nav>
B) <menu>
C) <header>
D) <footer>
Answer: A) <nav>
Explanation: The <nav>
tag is used to define navigation links within a document.
40. How do you create a hyperlink in HTML?
A) <a href="url">Link</a>
B) <link href="url">Link</link>
C) <url href="link">Link</url>
D) <hyperlink href="url">Link</hyperlink>
Answer: A) <a href="url">Link</a>
Explanation: The <a>
tag is used to create a hyperlink. The href
attribute specifies the destination URL.
41. What does the <iframe>
tag do in HTML?
A) Embeds a form
B) Embeds a video
C) Embeds an external webpage
D) Defines a frame for a document
Answer: C) Embeds an external webpage
Explanation: The <iframe>
tag is used to embed another HTML document within the current document.
42. Which tag is used to display an image in HTML?
A) <picture>
B) <image>
C) <img>
D) <src>
Answer: C) <img>
Explanation: The <img>
tag is used to display an image. The src
attribute is used to specify the image source.
43. Which of the following is used to create a comment in HTML?
A) /* This is a comment */
B) // This is a comment
C) <!-- This is a comment -->
D) # This is a comment
Answer: C) <!-- This is a comment -->
Explanation: In HTML, comments are enclosed within <!--
and -->
.
44. How do you create a checkbox in an HTML form?
A) <input type="text">
B) <input type="checkbox">
C) <checkbox>
D) <input type="radio">
Answer: B) <input type="checkbox">
Explanation: The <input type="checkbox">
tag is used to create a checkbox input in a form.
45. How do you add a title to an HTML page?
A) <head>Title</head>
B) <title>Title</title>
C) <meta>Title</meta>
D) <header>Title</header>
Answer: B) <title>Title</title>
Explanation: The <title>
tag is used to define the title of an HTML document, which appears in the browser's title bar.
46. What does the <link>
tag do in HTML?
A) Links an external JavaScript file
B) Links an external CSS file
C) Links an external image file
D) Defines a hyperlink to another webpage
Answer: B) Links an external CSS file
Explanation: The <link>
tag is used to link external resources, like a CSS file, to an HTML document.
47. How do you add a comment in JavaScript within an HTML document?
A) <!-- This is a comment -->
B) // This is a comment
C) /* This is a comment */
D) Both B and C
Answer: D) Both B and C
Explanation: In JavaScript, comments can be added using either //
for single-line comments or /* */
for multi-line comments.
48. How do you specify an external JavaScript file in HTML?
A) <script src="script.js">
B) <js src="script.js">
C) <script href="script.js">
D) <javascript src="script.js">
Answer: A) <script src="script.js">
Explanation: The <script>
tag with the src
attribute is used to specify an external JavaScript file.
49. Which tag is used to define a table header cell in HTML?
A) <th>
B) <td>
C) <tr>
D) <table>
Answer: A) <th>
Explanation: The <th>
tag is used to define header cells in a table, typically displaying bold, centered text.
50. What does the <footer>
tag define in an HTML document?
A) The main content area
B) The navigation section
C) The header section
D) The footer content, typically at the bottom of the page
Answer: D) The footer content, typically at the bottom of the page
Explanation: The <footer>
tag defines a footer section, which typically contains copyright information, contact links, or related content at the bottom of the page.