HTML Basics: 245 MCQs

Showing 200 of 245 multiple-choice questions from this kit.

Warm-up · 123 questions

Q1. What is the very first line in every HTML5 document?

Beginner
A `<body>`
B `<html>`
C `<head>`
D `<!DOCTYPE html>`

Answers and explanations are in the Veda app.

Q2. Which element is the root container that wraps all other HTML content?

Beginner
A `<html>`
B `<head>`
C `<body>`
D `<!DOCTYPE html>`

Answers and explanations are in the Veda app.

Q3. Which of the following is NOT typically placed inside the `<head>` section?

Beginner
A `<link rel="stylesheet" href="style.css">`
B `<title>`
C `<h1>`
D `<meta charset="UTF-8">`

Answers and explanations are in the Veda app.

Q4. What is the main consequence of forgetting the `<!DOCTYPE html>` declaration?

Beginner
A The page will not load at all.
B The page will load faster.
C The browser may render the page in quirks mode, breaking layouts.
D The `<title>` tag will be ignored.

Answers and explanations are in the Veda app.

Q5. Why are CSS stylesheets linked inside the `<head>` rather than the `<body>`?

Beginner
A To prevent a flash of unstyled content (FOUC).
B To make the HTML file smaller.
C To allow the browser to ignore CSS.
D To improve JavaScript performance.

Answers and explanations are in the Veda app.

Q6. A developer places a `<script>` tag inside the `<head>` that loads a large JavaScript file. What is the most likely negative effect?

Beginner
A The page will render faster.
B The JavaScript will not execute.
C The CSS will stop working.
D The page content may be delayed from rendering while the script loads.

Answers and explanations are in the Veda app.

Q7. Which attribute on the `<html>` tag improves accessibility by specifying the language of the page?

Beginner
A `class`
B `style`
C `lang`
D `id`

Answers and explanations are in the Veda app.

Q8. A student writes an HTML file with the following structure: `<!DOCTYPE html><html><body><head><title>Test</title></head></body></html>`. What is the main structural error?

Beginner
A The `<head>` is placed inside the `<body>`, which is incorrect.
B The `<title>` tag is missing.
C The `<html>` tag is missing the `lang` attribute.
D The `<!DOCTYPE html>` is missing.

Answers and explanations are in the Veda app.

Q9. The `<!DOCTYPE html>` declaration is an HTML tag.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q10. The `<head>` and `<body>` elements are siblings, both nested directly inside the `<html>` element.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q11. Placing `<link>` tags for CSS in the `<body>` is a best practice for performance.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q12. A valid HTML document can have multiple `<body>` elements.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q13. The ___ declaration must be the very first line in every HTML5 document to prevent quirks mode.

Beginner

Answers and explanations are in the Veda app.

Q14. The ___ element is the root container that wraps all other HTML content.

Beginner

Answers and explanations are in the Veda app.

Q15. The ___ section contains metadata such as the title and links to CSS files.

Beginner

Answers and explanations are in the Veda app.

Q16. The ___ attribute on the `<html>` tag specifies the language of the page, improving accessibility.

Beginner

Answers and explanations are in the Veda app.

Q17. What is the purpose of the `<!DOCTYPE html>` declaration?

Beginner

Answers and explanations are in the Veda app.

Q18. Name the four main structural components of an HTML document in order.

Beginner

Answers and explanations are in the Veda app.

Q19. What is the role of the `<html>` element?

Beginner

Answers and explanations are in the Veda app.

Q20. What type of information is stored in the `<head>` section?

Beginner

Answers and explanations are in the Veda app.

Q21. What is the function of the `<body>` element?

Beginner

Answers and explanations are in the Veda app.

Q22. What does the `<meta charset="UTF-8">` tag do?

Beginner

Answers and explanations are in the Veda app.

Q23. How many `<html>`, `<head>`, and `<body>` elements should a valid HTML document have?

Beginner

Answers and explanations are in the Veda app.

Q24. What is the relationship between the `<head>` and `<body>` elements?

Beginner

Answers and explanations are in the Veda app.

Q25. Which of the following is the correct way to write a closing tag for a paragraph?

Beginner
A `<p />`
B `</p>`
C `<\p>`
D `<p>`

Answers and explanations are in the Veda app.

Q26. What is the main difference between an opening tag and a closing tag?

Beginner
A The closing tag has an asterisk after the tag name.
B The closing tag is written in uppercase.
C The closing tag has a forward slash before the tag name.
D The closing tag has an exclamation mark.

Answers and explanations are in the Veda app.

Q27. Which of the following is a self-closing tag?

Beginner
A `<h1>`
B `<br>`
C `<li>`
D `<p>`

Answers and explanations are in the Veda app.

Q28. What does semantic HTML primarily improve?

Beginner
A Font styling
B Page loading speed
C Accessibility, SEO, and code readability
D Image quality

Answers and explanations are in the Veda app.

Q29. What is the correct nesting order for an unordered list with two items?

Beginner
A `<ul><li>Item 1</li><li>Item 2</li></ul>`
B `<li><ul>Item 1</ul></li>`
C `<li><ul>Item 1</li><li>Item 2</li></ul>`
D `<ul><li>Item 1<li>Item 2</ul>`

Answers and explanations are in the Veda app.

Q30. Which tag should you use to mark up a navigation menu for better accessibility?

Beginner
A `<header>`
B `<nav>`
C `<span>`
D `<div>`

Answers and explanations are in the Veda app.

Q31. What happens if you write `<p>Hello` without a closing tag?

Beginner
A The browser shows an error and stops rendering.
B The browser treats everything after as part of that paragraph until it finds a closing tag or the end of the document.
C The browser ignores the tag and displays plain text.
D The browser automatically adds a closing tag at the end of the line.

Answers and explanations are in the Veda app.

Q32. Why is using `<strong>` preferred over `<b>` in modern HTML?

Beginner
A `<strong>` is faster to render.
B `<strong>` has semantic meaning (importance), while `<b>` is purely stylistic.
C `<strong>` automatically adds a line break.
D `<strong>` works in all browsers, but `<b>` does not.

Answers and explanations are in the Veda app.

Q33. All HTML tags require a closing tag.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q34. HTML tag names are case-insensitive, but lowercase is the convention.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q35. Using semantic HTML tags can improve a website's search engine ranking.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q36. The `<img>` tag requires a closing `</img>` tag.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q37. An HTML ___ consists of an opening tag, content, and a closing tag.

Beginner

Answers and explanations are in the Veda app.

Q38. The ___ tag is used to create a hyperlink to another webpage.

Beginner

Answers and explanations are in the Veda app.

Q39. Placing one HTML element inside another is called ___.

Beginner

Answers and explanations are in the Veda app.

Q40. The `<h1>` to `<h6>` tags define headings with ___ importance as the number increases.

Beginner

Answers and explanations are in the Veda app.

Q41. What is an HTML tag?

Beginner

Answers and explanations are in the Veda app.

Q42. What is the difference between an opening tag and a closing tag?

Beginner

Answers and explanations are in the Veda app.

Q43. What is an HTML element?

Beginner

Answers and explanations are in the Veda app.

Q44. What is a self-closing tag? Give two examples.

Beginner

Answers and explanations are in the Veda app.

Q45. What does the `<p>` tag do?

Beginner

Answers and explanations are in the Veda app.

Q46. What do the `<h1>` to `<h6>` tags represent?

Beginner

Answers and explanations are in the Veda app.

Q47. What is the purpose of the `<a>` tag?

Beginner

Answers and explanations are in the Veda app.

Q48. What is the purpose of the `<img>` tag?

Beginner

Answers and explanations are in the Veda app.

Q49. What do `<ul>` and `<ol>` tags create?

Beginner

Answers and explanations are in the Veda app.

Q50. What is the convention for writing tag names in HTML?

Beginner

Answers and explanations are in the Veda app.

Q51. What does HTML stand for?

Beginner
A Home Tool Markup Language
B High Tech Modern Language
C HyperTransfer Markup Language
D HyperText Markup Language

Answers and explanations are in the Veda app.

Q52. Which of the following is a self-closing HTML tag?

Beginner
A `<h1>`
B `<p>`
C `<div>`
D `<img>`

Answers and explanations are in the Veda app.

Q53. Why is HTML not considered a programming language?

Beginner
A It cannot be used to create web pages.
B It requires a compiler to run.
C It does not support variables, loops, or conditional logic.
D It is only used for styling.

Answers and explanations are in the Veda app.

Q54. What is the purpose of the `alt` attribute on an `<img>` tag?

Beginner
A To link the image to another page
B To add a border to the image
C To specify the image height
D To provide alternative text for accessibility and SEO

Answers and explanations are in the Veda app.

Q55. Which HTML element wraps the entire document?

Beginner
A `<document>`
B `<body>`
C `<html>`
D `<head>`

Answers and explanations are in the Veda app.

Q56. What is semantic HTML?

Beginner
A Using HTML tags that convey the meaning of content
B Using HTML tags that only affect appearance
C Using HTML tags that are self-closing
D Using HTML tags that contain JavaScript

Answers and explanations are in the Veda app.

Q57. Which of the following is a valid HTML element with an attribute?

Beginner
A `<img src='photo.jpg'>`
B `<img source='photo.jpg'>`
C `<img href='photo.jpg'>`
D `<image src='photo.jpg'>`

Answers and explanations are in the Veda app.

Q58. What is the main advantage of separating HTML structure from CSS presentation?

Beginner
A It makes HTML a programming language.
B It allows the same HTML to be styled differently for different devices.
C It eliminates the need for JavaScript.
D It makes the HTML file larger.

Answers and explanations are in the Veda app.

Q59. HTML is a programming language that can perform calculations.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q60. The `<head>` element contains the visible content of a web page.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q61. Using semantic HTML tags can improve a website's search engine ranking.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q62. The `<br>` tag requires a closing tag like `</br>`.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q63. HTML uses ___ to annotate text and define the structure of a web page.

Beginner

Answers and explanations are in the Veda app.

Q64. The ___ attribute on an `<img>` tag provides a text description for accessibility and SEO.

Beginner

Answers and explanations are in the Veda app.

Q65. The hierarchical structure of an HTML document is called the ___.

Beginner

Answers and explanations are in the Veda app.

Q66. Modern best practice separates HTML for structure and ___ for presentation.

Beginner

Answers and explanations are in the Veda app.

Q67. What does HTML stand for?

Beginner

Answers and explanations are in the Veda app.

Q68. Is HTML a programming language? Explain briefly.

Beginner

Answers and explanations are in the Veda app.

Q69. What is the difference between an opening tag and a closing tag?

Beginner

Answers and explanations are in the Veda app.

Q70. Give two examples of self-closing HTML tags.

Beginner

Answers and explanations are in the Veda app.

Q71. What is the purpose of the `alt` attribute on an `<img>` tag?

Beginner

Answers and explanations are in the Veda app.

Q72. What are the two main sections inside an `<html>` element?

Beginner

Answers and explanations are in the Veda app.

Q73. What does the `<a>` tag do?

Beginner

Answers and explanations are in the Veda app.

Q74. What is the purpose of the `<head>` element?

Beginner

Answers and explanations are in the Veda app.

Q75. What does the term 'HyperText' in HTML refer to?

Beginner

Answers and explanations are in the Veda app.

Q76. Which HTML tag is used for the most important heading?

Beginner
A `<heading>`
B `<h6>`
C `<h1>`
D `<head>`

Answers and explanations are in the Veda app.

Q77. What does the `<p>` tag define?

Beginner
A A hyperlink
B A page title
C An image
D A paragraph of text

Answers and explanations are in the Veda app.

Q78. How many `<h1>` tags are recommended per web page?

Beginner
A As many as needed
B At least two
C Exactly one
D None, use `<h2>` instead

Answers and explanations are in the Veda app.

Q79. Why is it important not to skip heading levels (e.g., going from `<h1>` to `<h4>`)?

Beginner
A It is not allowed by HTML standards
B It makes the page load slower
C It causes the text to disappear
D It breaks the logical hierarchy for screen readers

Answers and explanations are in the Veda app.

Q80. Which of the following is a correct use of headings and paragraphs?

Beginner
A `<h2>Section Title</h2><h3>Content here.</h3>`
B `<h2>Section Title</h2><p>Content here.</p>`
C `<p>Section Title</p><p>Content here.</p>`
D `<p><h2>Section Title</h2>Content here.</p>`

Answers and explanations are in the Veda app.

Q81. What is the primary role of headings in a web page?

Beginner
A To add decorative styling
B To make text larger and bolder
C To create hyperlinks
D To provide structural hierarchy and meaning

Answers and explanations are in the Veda app.

Q82. A student writes `<h1>Main Title</h1><h3>Subsection</h3>`. What is the issue?

Beginner
A There is no paragraph after the heading
B The `<h3>` tag is misspelled
C A heading level was skipped, breaking hierarchy
D The `<h1>` tag should be `<h2>`

Answers and explanations are in the Veda app.

Q83. How do search engines primarily use heading tags?

Beginner
A To count the number of images
B To determine the page's loading speed
C To check for spelling errors
D To understand the topic and structure of content

Answers and explanations are in the Veda app.

Q84. The `<p>` tag automatically adds space before and after the paragraph.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q85. You can use `<h1>` multiple times on a single page without any negative effects.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q86. Headings should be used for their visual appearance, such as making text larger.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q87. A well-structured page with headings and paragraphs improves both accessibility and SEO.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q88. HTML headings range from `<h1>` (most important) to `<h6>` (___ important).

Beginner

Answers and explanations are in the Veda app.

Q89. The ___ tag defines a paragraph in HTML.

Beginner

Answers and explanations are in the Veda app.

Q90. Skipping heading levels (e.g., from `<h1>` to `<h3>`) breaks the logical ___ for screen readers.

Beginner

Answers and explanations are in the Veda app.

Q91. To change the visual size of a heading, you should use ___ instead of misusing heading tags.

Beginner

Answers and explanations are in the Veda app.

Q92. What are the HTML tags used for headings and what do they represent?

Beginner

Answers and explanations are in the Veda app.

Q93. What does the `<p>` tag define and how do browsers display it by default?

Beginner

Answers and explanations are in the Veda app.

Q94. How many `<h1>` tags should you use per page and why?

Beginner

Answers and explanations are in the Veda app.

Q95. Do paragraphs have a hierarchy like headings?

Beginner

Answers and explanations are in the Veda app.

Q96. What is the best practice for using multiple `<h2>` tags?

Beginner

Answers and explanations are in the Veda app.

Q97. When would you use `<h4>` to `<h6>` tags?

Beginner

Answers and explanations are in the Veda app.

Q98. Do you need a heading before every paragraph?

Beginner

Answers and explanations are in the Veda app.

Q99. What is the main purpose of using headings in a web page?

Beginner

Answers and explanations are in the Veda app.

Q100. Which HTML element is used to group input fields and control form submission?

Beginner
A `<div>`
B `<fieldset>`
C `<form>`
D `<input>`

Answers and explanations are in the Veda app.

Q101. What attribute of the `<input>` tag determines the behavior and appearance of the input field?

Beginner
A `type`
B `value`
C `id`
D `name`

Answers and explanations are in the Veda app.

Q102. What happens if you forget to include the `name` attribute on an input field?

Beginner
A The input's value is ignored on submission.
B The form will show an error.
C The form will not submit.
D The input field will not display.

Answers and explanations are in the Veda app.

Q103. Which input type creates a button that automatically submits the form?

Beginner
A `type="reset"`
B `type="submit"`
C `type="button"`
D `type="image"`

Answers and explanations are in the Veda app.

Q104. A developer uses `<input type="button" value="Click">` expecting it to submit the form. What will happen?

Beginner
A The form is reset.
B The form submits normally.
C Nothing happens; the button does nothing without JavaScript.
D The page reloads.

Answers and explanations are in the Veda app.

Q105. Which input type provides basic email validation and shows a mobile-friendly keyboard?

Beginner
A `type="password"`
B `type="text"`
C `type="url"`
D `type="email"`

Answers and explanations are in the Veda app.

Q106. What is the primary difference between `<input type="checkbox">` and `<input type="radio">`?

Beginner
A Checkboxes allow multiple selections; radio buttons allow only one.
B Checkboxes are square; radio buttons are round.
C Checkboxes submit data; radio buttons do not.
D Radio buttons require a name attribute; checkboxes do not.

Answers and explanations are in the Veda app.

Q107. A student writes `<form><input type="text"></form>` and wonders why no data is sent. What is the most likely missing element?

Beginner
A A `name` attribute on the input
B A submit button
C An `action` attribute on the form
D A `method` attribute on the form

Answers and explanations are in the Veda app.

Q108. The `<form>` element is visible on the page by default.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q109. An input field without a `name` attribute will still send its value to the server on form submission.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q110. `<input type="number">` restricts input to numeric values and shows a numeric keypad on mobile devices.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q111. Using `<input type="button">` will submit the form when clicked.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q112. The ___ attribute of the `<input>` tag determines the kind of input field, such as text, password, or email.

Beginner

Answers and explanations are in the Veda app.

Q113. To create a password field that masks user input, use `<input type="___">`.

Beginner

Answers and explanations are in the Veda app.

Q114. A form cannot be submitted without a(n) ___ element, such as `<input type="submit">`.

Beginner

Answers and explanations are in the Veda app.

Q115. If an input field lacks the ___ attribute, its value will not be sent to the server when the form is submitted.

Beginner

Answers and explanations are in the Veda app.

Q116. What is the purpose of the `<form>` element in HTML?

Beginner

Answers and explanations are in the Veda app.

Q117. Name three common input types used in HTML forms.

Beginner

Answers and explanations are in the Veda app.

Q118. Why is the `name` attribute important on an input field?

Beginner

Answers and explanations are in the Veda app.

Q119. What does `<input type="password">` do differently from `<input type="text">`?

Beginner

Answers and explanations are in the Veda app.

Q120. What is the purpose of `<input type="number">`?

Beginner

Answers and explanations are in the Veda app.

Q121. What does the `<form>` element look like on a webpage without CSS styling?

Beginner

Answers and explanations are in the Veda app.

Q122. List two real-world examples of forms on websites.

Beginner

Answers and explanations are in the Veda app.

Q123. What attribute must be added to an input field for its value to be sent to the server?

Beginner

Answers and explanations are in the Veda app.

Building up · 57 questions

Q124. Why is the `<title>` tag important for SEO?

Intermediate

Answers and explanations are in the Veda app.

Q125. Where should CSS stylesheets be linked in an HTML document and why?

Intermediate

Answers and explanations are in the Veda app.

Q126. Why are `<script>` tags often placed at the end of the `<body>`?

Intermediate

Answers and explanations are in the Veda app.

Q127. What is quirks mode and what causes it?

Intermediate

Answers and explanations are in the Veda app.

Q128. What does the `lang` attribute on the `<html>` tag do?

Intermediate

Answers and explanations are in the Veda app.

Q129. What happens if you place `<title>` or `<link>` tags inside the `<body>`?

Intermediate

Answers and explanations are in the Veda app.

Q130. In what order does a browser process an HTML document?

Intermediate

Answers and explanations are in the Veda app.

Q131. A developer writes the following HTML snippet: ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>My Page</title> </head> <body> <h1>Welcome</h1> <p>This is a paragraph.</p> </body> </html> ``` If the developer removes the `<!DOCTYPE html>` declaration, what is the most likely consequence?

Intermediate
A The `<title>` tag will no longer appear on the browser tab.
B The `lang` attribute will become invalid.
C The browser may enter quirks mode, causing unpredictable CSS rendering.
D The page will not load at all.

Answers and explanations are in the Veda app.

Q132. Consider the following HTML document structure: ```html <!DOCTYPE html> <html> <body> <head> <title>Test</title> </head> <p>Content</p> </body> </html> ``` What is the primary structural error in this document?

Intermediate
A The `<head>` element is incorrectly placed inside the `<body>` element.
B The `<p>` tag should be inside a `<div>` element.
C The `<title>` tag is missing a closing slash.
D The `lang` attribute is missing from the `<html>` tag.

Answers and explanations are in the Veda app.

Q133. A developer wants to improve the performance of a webpage that includes a large JavaScript file. Where should the `<script>` tag be placed, and why?

Intermediate
A Immediately after the `<!DOCTYPE html>` declaration, to ensure the script runs first.
B Inside the `<html>` tag but outside `<head>` and `<body>`, to avoid blocking rendering.
C Inside the `<head>` section, because JavaScript should load before the page content.
D At the end of the `<body>` section, so the page content renders before the script downloads and executes.

Answers and explanations are in the Veda app.

Q134. Which of the following statements best explains the relationship between the `<head>` and `<body>` elements in a valid HTML5 document?

Intermediate
A The `<body>` element is a child of the `<head>` element.
B The `<head>` element is a child of the `<body>` element.
C The `<head>` and `<body>` elements are siblings, both nested directly inside the `<html>` element.
D The `<head>` element comes after the `<body>` element in the document order.

Answers and explanations are in the Veda app.

Q135. A developer notices that their webpage displays a flash of unstyled content (FOUC) when loading. Which of the following is the most likely cause related to document structure?

Intermediate
A The `<title>` tag is placed inside the `<body>` section.
B The `<link>` tag for the CSS stylesheet is placed inside the `<body>` section instead of the `<head>`.
C The `<!DOCTYPE html>` declaration is missing.
D The `lang` attribute on the `<html>` tag is set to an incorrect value.

Answers and explanations are in the Veda app.

Q136. What is nesting in HTML?

Intermediate

Answers and explanations are in the Veda app.

Q137. What is semantic HTML?

Intermediate

Answers and explanations are in the Veda app.

Q138. Why is semantic HTML important for accessibility?

Intermediate

Answers and explanations are in the Veda app.

Q139. What happens if you forget a closing tag in HTML?

Intermediate

Answers and explanations are in the Veda app.

Q140. What is the tree structure of HTML elements?

Intermediate

Answers and explanations are in the Veda app.

Q141. Consider the following HTML snippet: ```html <article> <h2>Title</h2> <p>Content <strong>important</strong> text.</p> </article> ``` Which statement best explains the relationship between the `<strong>` element and the `<p>` element?

Intermediate
A The `<strong>` element is a descendant of the `<article>` element but not of the `<p>` element.
B The `<strong>` element is a child of the `<p>` element, and the `<p>` element is a child of the `<article>` element.
C The `<strong>` element is a parent of the `<p>` element because it contains the text 'important'.
D The `<strong>` element is a sibling of the `<p>` element because they are at the same nesting level.

Answers and explanations are in the Veda app.

Q142. Which of the following best explains why using `<nav>` for a navigation menu is preferred over using a generic `<div>` with a class like `class="nav"`?

Intermediate
A The `<nav>` tag automatically applies CSS styles that make the menu look better than a `<div>`.
B The `<nav>` tag is required for the menu to be clickable, while a `<div>` cannot contain links.
C The `<nav>` tag is a self-closing tag, so it reduces the amount of code needed.
D The `<nav>` tag provides semantic meaning that helps screen readers identify the navigation region, improving accessibility.

Answers and explanations are in the Veda app.

Q143. An HTML document contains the following code: ```html <p>First paragraph <p>Second paragraph</p> ``` What is the most likely outcome when a browser renders this code?

Intermediate
A The browser will treat the text 'First paragraph' as a paragraph, and then treat 'Second paragraph' as a separate paragraph, but the first paragraph may incorrectly include subsequent content.
B The browser will display an error because the first `<p>` tag is missing its closing tag.
C The browser will ignore the missing closing tag and display both lines as a single paragraph.
D The browser will automatically close the first `<p>` tag before the second `<p>` tag, so both paragraphs display correctly.

Answers and explanations are in the Veda app.

Q144. Given the following HTML: ```html <ul> <li>Apples</li> <li>Bananas</li> </ul> ``` If a developer wants to add a third item 'Cherries' after 'Bananas', which of the following correctly demonstrates the proper nesting and tag usage?

Intermediate
A ```html <ul> <li>Apples</li> <li>Bananas</li> <li>Cherries</li> </li> ```
B ```html <ul> <li>Apples</li> <li>Bananas</li> <li>Cherries</li> </ul> ``` (Note: This is identical to the first option, but with an extra space before `<ul>`)
C ```html <ul> <li>Apples</li> <li>Bananas</li> <li>Cherries</li> </ul> ```
D ```html <ul> <li>Apples</li> <li>Bananas</li> <li>Cherries</ul> ```

Answers and explanations are in the Veda app.

Q145. Which of the following statements correctly compares the `<b>` tag and the `<strong>` tag in modern HTML?

Intermediate
A Both tags are identical in meaning and should be used interchangeably.
B The `<strong>` tag conveys semantic importance, whereas `<b>` is a presentational tag with no semantic meaning.
C The `<b>` tag is semantic and indicates importance, while `<strong>` is purely presentational.
D The `<b>` tag is a self-closing tag, while `<strong>` requires a closing tag.

Answers and explanations are in the Veda app.

Q146. What is the Document Object Model (DOM)?

Intermediate

Answers and explanations are in the Veda app.

Q147. What is semantic HTML?

Intermediate

Answers and explanations are in the Veda app.

Q148. Why should you avoid using `<font>` or `<center>` tags in modern HTML?

Intermediate

Answers and explanations are in the Veda app.

Q149. How does HTML help with web accessibility?

Intermediate

Answers and explanations are in the Veda app.

Q150. What is the difference between HTML and CSS?

Intermediate

Answers and explanations are in the Veda app.

Q151. Name three places where HTML is used besides web pages.

Intermediate

Answers and explanations are in the Veda app.

Q152. Given the following HTML snippet: ```html <ul> <li>Item A</li> <li>Item B</li> </ul> ``` Which statement best describes the relationship between the `<ul>` and `<li>` elements?

Intermediate
A The `<ul>` and `<li>` elements are both self-closing tags.
B The `<li>` elements are nested inside the `<ul>`, making them child nodes of the `<ul>` in the DOM.
C The `<ul>` and `<li>` elements are siblings in the DOM tree.
D The `<ul>` is a child of each `<li>` element.

Answers and explanations are in the Veda app.

Q153. Why is HTML considered a **markup language** rather than a **programming language**?

Intermediate
A HTML can perform arithmetic calculations using tags like `<math>`.
B HTML uses tags to annotate and describe the structure of content, but it lacks logic constructs like loops and conditionals.
C HTML supports variables and functions, similar to JavaScript.
D HTML is compiled into machine code before being displayed in a browser.

Answers and explanations are in the Veda app.

Q154. A developer writes the following HTML: ```html <img src="logo.png" alt="Company Logo"> ``` Which of the following best explains the role of the `alt` attribute in terms of accessibility and SEO?

Intermediate
A The `alt` attribute is used to resize the image on the page.
B The `alt` attribute provides a text alternative for screen readers and helps search engines understand the image content.
C The `alt` attribute controls the border color of the image.
D The `alt` attribute is optional and has no impact on accessibility or SEO.

Answers and explanations are in the Veda app.

Q155. Compare the following two approaches for creating a heading on a web page: - Approach A: `<h1>Welcome</h1>` - Approach B: `<div style="font-size: 32px; font-weight: bold;">Welcome</div>` Which statement correctly explains the advantage of Approach A?

Intermediate
A Approach A is the only way to create a heading that is centered on the page.
B Approach A uses semantic HTML, which improves accessibility for screen readers and helps search engines understand the page structure.
C Approach B is invalid HTML because `<div>` cannot contain text.
D Approach A is more concise and always displays the heading in a larger font than Approach B.

Answers and explanations are in the Veda app.

Q156. Which of the following best explains why modern best practice separates HTML structure from CSS presentation, as opposed to using tags like `<font>` and `<center>`?

Intermediate
A Separation of concerns makes code cleaner, easier to maintain, and improves accessibility by keeping semantic meaning intact.
B Using `<font>` and `<center>` is faster for the browser to render than CSS.
C HTML cannot include any styling information, so CSS must always be used separately.
D CSS cannot be used to style elements that are defined with semantic HTML tags.

Answers and explanations are in the Veda app.

Q157. Why is it important not to skip heading levels?

Intermediate

Answers and explanations are in the Veda app.

Q158. How do screen readers use heading tags?

Intermediate

Answers and explanations are in the Veda app.

Q159. What is the impact of headings on SEO?

Intermediate

Answers and explanations are in the Veda app.

Q160. Can headings be used just to make text larger? Why or why not?

Intermediate

Answers and explanations are in the Veda app.

Q161. Is it acceptable to nest a heading inside a `<p>` tag? Explain.

Intermediate

Answers and explanations are in the Veda app.

Q162. What happens if you use headings solely for visual appearance?

Intermediate

Answers and explanations are in the Veda app.

Q163. How do headings and paragraphs work together to form a web page structure?

Intermediate

Answers and explanations are in the Veda app.

Q164. A developer creates a webpage with the following structure: ```html <h1>My Blog</h1> <h2>About Me</h2> <p>I am a web developer.</p> <h3>My Skills</h3> <p>HTML, CSS, JavaScript.</p> <h2>Contact</h2> <p>Email me at example@example.com.</p> ``` Which of the following best describes the relationship between the `<h3>` tag and the `<h2>` tags in this structure?

Intermediate
A The `<h3>` tag is incorrectly placed because it should be an `<h2>` tag.
B The `<h3>` tag is a subsection of the `<h1>` tag ("My Blog") only.
C The `<h3>` tag is a subsection of the second `<h2>` tag ("Contact").
D The `<h3>` tag is a subsection of the first `<h2>` tag ("About Me").

Answers and explanations are in the Veda app.

Q165. Consider the following HTML snippet: ```html <p>Welcome to our site.</p> <h2>Services</h2> <p>We offer web design.</p> <h3>Web Design</h3> <p>We create responsive layouts.</p> ``` What is the main structural issue with this snippet?

Intermediate
A The `<p>` tag before the `<h2>` tag is unnecessary and should be removed.
B The `<h3>` tag is used without a preceding `<h2>` tag that introduces the section.
C The snippet lacks an `<h1>` tag to define the page's main topic.
D The `<h2>` tag should be an `<h1>` tag because it is the first heading.

Answers and explanations are in the Veda app.

Q166. A student writes the following code: ```html <h2>Section Title</h2> <p>Some text here.</p> <h4>Subsection</h4> <p>More text.</p> ``` Why is this considered poor practice?

Intermediate
A Because there should be a `<h3>` tag before the `<h4>` tag.
B Because the `<h4>` tag is too small for a subsection.
C Because `<h4>` tags are not allowed after `<h2>` tags.
D Because heading levels should not be skipped (from `<h2>` to `<h4>`).

Answers and explanations are in the Veda app.

Q167. Which of the following statements best explains how headings and paragraphs contribute to accessibility?

Intermediate
A Headings provide visual styling, while paragraphs provide content; both are equally important for screen readers.
B Paragraphs are more important than headings for accessibility because they contain the main information.
C Screen readers use heading tags to create a navigable outline of the page, allowing users to jump between sections, while paragraphs provide the detailed content.
D Headings and paragraphs are only useful for visual users; screen readers ignore them.

Answers and explanations are in the Veda app.

Q168. A developer wants to make a subheading appear smaller than the main heading but still maintain proper document structure. Which approach is correct?

Intermediate
A Use `<h1>` for the main heading and `<h6>` for the subheading, then use CSS to make the `<h6>` text larger.
B Use `<h1>` for the main heading and `<h2>` for the subheading, then use CSS (`font-size`) to adjust the visual size of the `<h2>`.
C Use `<p>` with a CSS class that mimics heading styling for the subheading.
D Use `<h1>` for both headings, but add a CSS class to make the second one smaller.

Answers and explanations are in the Veda app.

Q169. How does `<input type="email">` improve the user experience on mobile devices?

Intermediate

Answers and explanations are in the Veda app.

Q170. What is the difference between `<input type="submit">` and `<input type="button">`?

Intermediate

Answers and explanations are in the Veda app.

Q171. What happens if you forget to include a submit button in a form?

Intermediate

Answers and explanations are in the Veda app.

Q172. Can a form be submitted without a `name` attribute on its inputs? Explain.

Intermediate

Answers and explanations are in the Veda app.

Q173. How do checkboxes and radio buttons differ in terms of user selection?

Intermediate

Answers and explanations are in the Veda app.

Q174. What is a common mistake beginners make when creating a submit button?

Intermediate

Answers and explanations are in the Veda app.

Q175. Why might a developer use `<input type="email">` instead of `<input type="text">` for an email field?

Intermediate

Answers and explanations are in the Veda app.

Q176. A developer creates a form with `<input type="text" name="city">` and `<input type="submit">`, but when the form is submitted, the server receives no data. Which of the following is the most likely cause?

Intermediate
A The `<input type="submit">` is missing a `name` attribute.
B The `<input type="text">` is missing a `value` attribute.
C The `<input type="text">` has a `type` of `text` instead of `email`.
D The `<form>` element is missing an `action` attribute.

Answers and explanations are in the Veda app.

Q177. Consider the following HTML snippet: ```html <form> <input type="radio" name="color" value="red"> Red <input type="radio" name="color" value="blue"> Blue <input type="radio" name="color" value="green"> Green <input type="submit"> </form> ``` If a user selects "Blue" and submits the form, what will be sent to the server?

Intermediate
A `blue`
B `color=blue`
C `color=blue&color=red&color=green`
D Nothing, because radio buttons require a `checked` attribute to send data.

Answers and explanations are in the Veda app.

Q178. A developer uses `<input type="button" value="Click">` inside a form expecting it to submit the form. What will happen when the button is clicked?

Intermediate
A The form will submit automatically.
B The browser will display an error message.
C Nothing happens unless JavaScript is attached to the button.
D The button will reset all form fields.

Answers and explanations are in the Veda app.

Q179. Which of the following best explains why `<input type="email">` improves user experience on mobile devices compared to `<input type="text">`?

Intermediate
A It displays a keyboard optimized for email entry, including the '@' symbol and a '.com' key.
B It restricts input to only valid email addresses and prevents any typos.
C It changes the background color of the input field to indicate it's for email.
D It automatically sends the form to the server without a submit button.

Answers and explanations are in the Veda app.

Q180. A student writes the following code: ```html <form> <input type="checkbox" name="subscribe" value="yes"> Subscribe to newsletter <input type="submit"> </form> ``` When the form is submitted with the checkbox unchecked, what data is sent to the server?

Intermediate
A `subscribe=no`
B `subscribe=yes`
C `subscribe=` (empty value)
D No data related to the checkbox is sent.

Answers and explanations are in the Veda app.

Topper level · 20 questions

Q181. A developer writes the following HTML document: ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>My Page</title> <script src="large.js"></script> </head> <body> <h1>Welcome</h1> <p>Content</p> </body> </html> ``` The developer wants to improve perceived performance. Which of the following changes to the document structure would MOST effectively reduce the time users wait before seeing visible content, assuming `large.js` is a blocking script?

Advanced
A Remove the `<meta charset="UTF-8">` tag to reduce HTTP requests.
B Move the `<script>` tag to the end of the `<body>`, just before `</body>`.
C Add a `defer` attribute to the `<script>` tag while keeping it in the `<head>`.
D Move the `<link>` tag for CSS into the `<body>` to free up the `<head>` for the script.

Answers and explanations are in the Veda app.

Q182. Consider the following HTML document: ```html <!DOCTYPE html> <html> <head> <title>Test</title> <style> body { background: red; } </style> </head> <body> <p>Hello</p> <script> document.title = "New Title"; </script> </body> </html> ``` A validator reports that the document is malformed. Which of the following is the MOST accurate description of the structural error?

Advanced
A The `<style>` element is not allowed inside the `<head>`; it must be placed in the `<body>`.
B The document is missing the `lang` attribute on the `<html>` element, which is required for validity.
C The `<script>` element in the `<body>` modifies the `<title>`, which is invalid because the `<title>` is already closed.
D The document is actually valid; the validator is incorrect.

Answers and explanations are in the Veda app.

Q183. A developer encounters a webpage that renders differently in Internet Explorer 11 compared to Chrome. The developer inspects the source and finds the first line is: ```html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> ``` The developer wants the page to render consistently in modern browsers using HTML5 standards. Which of the following is the CORRECT change to the document structure?

Advanced
A Remove the DOCTYPE entirely; modern browsers will default to HTML5 mode.
B Keep the existing DOCTYPE but add `<!DOCTYPE html>` as a second line to override it.
C Replace the DOCTYPE with `<!DOCTYPE html>` and add `<meta charset="UTF-8">` in the `<head>`.
D Change the DOCTYPE to `<!DOCTYPE HTML>` and add `lang="en"` to the `<html>` tag.

Answers and explanations are in the Veda app.

Q184. A developer writes the following HTML: ```html <!DOCTYPE html> <html lang="en"> <body> <h1>Title</h1> <head> <title>Page Title</title> <link rel="stylesheet" href="style.css"> </head> <p>Content</p> </body> </html> ``` The page loads, but the CSS does not apply and the browser tab shows an empty title. Which of the following BEST explains the behavior?

Advanced
A The `lang="en"` attribute on `<html>` overrides the `<title>` element, causing it to be ignored.
B The `<head>` element is a void element and cannot contain child elements; the browser automatically closes it before the `<title>`.
C The browser treats the `<head>` as a semantic sectioning element and moves its content to the correct location automatically.
D The `<head>` element is placed inside the `<body>`, so the browser ignores the `<title>` and `<link>` tags because they are not in the document's `<head>`.

Answers and explanations are in the Veda app.

Q185. A developer is building a multilingual website. The page for English users starts with: ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Welcome</title> </head> <body> <p>Hello</p> </body> </html> ``` The developer wants to create a Spanish version of the same page. Which of the following changes to the document structure is BOTH necessary and sufficient to ensure the page is correctly interpreted as Spanish by browsers and assistive technologies?

Advanced
A Change the `lang` attribute to `lang="es"` on the `<html>` tag and update the `<title>` and `<p>` content to Spanish.
B Only change the `lang` attribute to `lang="es"` on the `<html>` tag; the content language is automatically inferred.
C Change the `<meta charset="UTF-8">` to `<meta charset="ISO-8859-1">` to support Spanish characters.
D Add a second `<html>` element with `lang="es"` and place the Spanish content inside it.

Answers and explanations are in the Veda app.

Q186. Consider the following HTML snippet: ```html <article> <h2>Title</h2> <p>Content <strong>important</strong> text.</p> </article> ``` If a developer wants to ensure that the `<strong>` element is semantically correct for conveying strong importance, which of the following best describes the relationship between `<strong>` and `<p>` in this snippet?

Advanced
A The `<strong>` element is a sibling of the `<p>` element because they are both inside `<article>`.
B The `<strong>` element is a parent of the `<p>` element because it contains the word 'important'.
C The `<strong>` element is a descendant of `<article>` but not directly nested inside `<p>`.
D The `<strong>` element is a child of the `<p>` element, and the `<p>` element is a child of the `<article>` element.

Answers and explanations are in the Veda app.

Q187. An HTML document contains the following code: ```html <p>First paragraph <p>Second paragraph</p> ``` What is the most likely outcome when a browser renders this code, and why?

Advanced
A Both paragraphs are displayed correctly because browsers automatically add closing tags for `<p>` elements.
B The browser throws an error and refuses to render the page because the first `<p>` is missing its closing tag.
C Only 'Second paragraph' is displayed because the missing closing tag causes the first paragraph to be ignored.
D The text 'First paragraph' is displayed as a heading because the browser interprets the missing closing tag as a formatting error.

Answers and explanations are in the Veda app.

Q188. Which of the following statements correctly compares the `<b>` tag and the `<strong>` tag in modern HTML, considering both semantics and rendering?

Advanced
A `<b>` is preferred over `<strong>` because it is more widely supported in older browsers.
B `<strong>` adds semantic importance to the enclosed text, while `<b>` only applies bold styling without conveying importance.
C Both `<b>` and `<strong>` are purely stylistic and have no semantic meaning; they are interchangeable.
D `<strong>` is used for visual emphasis only, while `<b>` is used for structural importance.

Answers and explanations are in the Veda app.

Q189. A developer writes the following HTML: ```html <nav> <a href="/home">Home</a> <a href="/about">About</a> </nav> ``` Which of the following best explains why using `<nav>` for a navigation menu is preferred over using a generic `<div>` with a class like `class="nav"`?

Advanced
A The `<nav>` tag is required by HTML5 for any group of links, whereas a `<div>` would cause a validation error.
B The `<nav>` tag is faster to render than a `<div>` because browsers optimize navigation elements.
C The `<nav>` tag automatically styles the links as a horizontal menu, while a `<div>` requires additional CSS.
D The `<nav>` tag provides semantic meaning, improving accessibility for screen readers and aiding search engines in understanding the page structure.

Answers and explanations are in the Veda app.

Q190. Given the following HTML snippet: ```html <html> <head> <title>My Page</title> </head> <body> <article> <h1>Welcome</h1> <p>This is a paragraph.</p> <img src="photo.jpg" alt="Photo"> </article> </body> </html> ``` Which of the following best describes the relationship between the `<article>` element and the `<img>` element in terms of the Document Object Model (DOM)?

Advanced
A The `<article>` element is a parent of the `<body>` element, and the `<img>` is a child of the `<article>`.
B The `<img>` element is a sibling of the `<article>` element because both are inside the `<body>`.
C The `<img>` element is a child of the `<article>` element, and the `<article>` element is a descendant of the `<body>` element.
D The `<img>` element is a descendant of the `<h1>` element because it appears after it in the source order.

Answers and explanations are in the Veda app.

Q191. A developer writes the following HTML for a navigation menu: ```html <nav> <ul> <li><a href="/home">Home</a></li> <li><a href="/about">About</a></li> </ul> </nav> ``` Which statement best evaluates the impact of using the `<nav>` element versus a generic `<div>` with the same content, considering accessibility and SEO?

Advanced
A Using `<nav>` improves accessibility but harms SEO because search engines ignore semantic elements.
B Using `<nav>` improves SEO but harms accessibility because screen readers cannot parse semantic elements.
C Using `<nav>` improves accessibility by allowing screen readers to identify the navigation region, and improves SEO by helping search engines understand the page structure.
D Using `<nav>` has no impact on accessibility or SEO because both render the same visually.

Answers and explanations are in the Veda app.

Q192. Consider the following two approaches to create a red, bold heading: **Approach A:** ```html <h1 style="color: red; font-weight: bold;">Important Heading</h1> ``` **Approach B:** ```html <div style="font-size: 32px; color: red; font-weight: bold;">Important Heading</div> ``` Which statement correctly analyzes the advantages of Approach A over Approach B in terms of modern best practices?

Advanced
A Approach A is better because it uses a heading tag, which provides semantic meaning for accessibility and SEO, while Approach B uses a generic `<div>` that lacks semantic structure.
B Both approaches are equally valid because they produce the same visual result, and modern best practices only care about visual appearance.
C Approach A is worse because inline styles are discouraged, and Approach B uses a `<div>` which is the recommended element for headings.
D Approach B is better because it uses a `<div>` which is more flexible for styling, and the `font-size` property ensures consistent rendering across browsers.

Answers and explanations are in the Veda app.

Q193. An HTML document contains the following code: ```html <p>This is a <span>highlighted</span> word.</p> ``` A developer argues that the `<span>` element is a block-level element because it is nested inside a `<p>`. Evaluate this claim based on the standard behavior of HTML elements.

Advanced
A The claim is incorrect because `<span>` is a replaced element like `<img>`, and replaced elements are always block-level.
B The claim is correct because any element nested inside a block-level element becomes block-level itself.
C The claim is incorrect because `<span>` is an inline element by default, regardless of its parent; nesting does not change its display type.
D The claim is correct because `<span>` is a block-level element that can contain other block-level elements.

Answers and explanations are in the Veda app.

Q194. A developer creates an HTML email newsletter with the following structure: ```html <html> <body> <h1>Monthly Update</h1> <p>Welcome to our newsletter.</p> <img src="banner.png" alt="Banner image"> <p>Read more <a href="https://example.com">here</a>.</p> </body> </html> ``` Which of the following best evaluates the potential issues with this HTML when rendered in an email client that does not support external stylesheets?

Advanced
A The `<a>` link will not work in email clients because hyperlinks are not supported in HTML emails.
B The `<h1>` and `<p>` elements may have inconsistent styling across email clients, and the `<img>` might not display if images are blocked, but the `alt` attribute provides a fallback.
C The email will render correctly because all email clients fully support all HTML elements and attributes.
D The `<html>` and `<body>` tags are unnecessary in email HTML and will cause rendering errors in all email clients.

Answers and explanations are in the Veda app.

Q195. A developer is creating a documentation page with the following structure: ```html <h1>API Reference</h1> <h2>Authentication</h2> <p>Details about API keys.</p> <h3>Rate Limits</h3> <p>Maximum 100 requests per hour.</p> <h2>Endpoints</h2> <h4>GET /users</h4> <p>Returns a list of users.</p> ``` Which of the following best describes the structural problem in this snippet?

Advanced
A The `<h4>` tag is used incorrectly because `<h4>` should only appear after `<h3>`.
B The `<h1>` tag should be used again for each major section to improve SEO.
C The heading hierarchy is broken because `<h4>` is used directly under `<h2>`, skipping `<h3>`.
D The `<p>` tags should not follow `<h3>` and `<h4>` directly; they should be wrapped in a `<div>`.

Answers and explanations are in the Veda app.

Q196. Consider the following HTML snippet: ```html <h1>My Portfolio</h1> <h2>Projects</h2> <p>Here are some of my projects.</p> <h3>Project A</h3> <p>Description of Project A.</p> <h3>Project B</h3> <p>Description of Project B.</p> <h2>Skills</h2> <p>I know HTML, CSS, and JavaScript.</p> ``` A developer wants to add a sub-subsection under "Project A" called "Technologies Used" that is less important than the project name but more important than a paragraph. Which of the following is the correct way to maintain proper heading hierarchy?

Advanced
A Use `<h4>Technologies Used</h4>` directly after the `<h3>Project A</h3>`.
B Use `<h3>Technologies Used</h3>` because it is a subsection of Project A.
C Use `<h2>Technologies Used</h2>` to make it stand out.
D Use `<p><strong>Technologies Used</strong></p>` to avoid adding another heading level.

Answers and explanations are in the Veda app.

Q197. A web page has the following structure: ```html <h1>Online Store</h1> <h2>Electronics</h2> <p>Browse our electronics.</p> <h3>Laptops</h3> <p>High-performance laptops.</p> <h3>Phones</h3> <p>Latest smartphones.</p> <h2>Clothing</h2> <p>Fashion for everyone.</p> <h3>Men's Wear</h3> <p>Shirts and pants.</p> <h4>Formal Shirts</h4> <p>For office wear.</p> <h4>Casual Shirts</h4> <p>For everyday use.</p> ``` A developer wants to add a new section "Accessories" under "Electronics" that is at the same level as "Laptops" and "Phones". Which of the following is the correct HTML to insert?

Advanced
A `<p><strong>Accessories</strong></p><p>Chargers, cases, etc.</p>`
B `<h2>Accessories</h2><p>Chargers, cases, etc.</p>`
C `<h4>Accessories</h4><p>Chargers, cases, etc.</p>`
D `<h3>Accessories</h3><p>Chargers, cases, etc.</p>`

Answers and explanations are in the Veda app.

Q198. A developer writes the following code for a blog post: ```html <h1>10 Tips for Healthy Living</h1> <p>Introduction paragraph.</p> <h2>Tip 1: Exercise Regularly</h2> <p>Details about exercise.</p> <h2>Tip 2: Eat Balanced Meals</h2> <p>Details about diet.</p> <h3>Breakfast Ideas</h3> <p>Oatmeal, eggs, etc.</p> <h2>Tip 3: Stay Hydrated</h2> <p>Drink water.</p> ``` Which of the following statements best evaluates the structural correctness of this snippet?

Advanced
A The structure is correct because `<h3>` is properly nested under `<h2>` and the hierarchy is maintained, even though not all `<h2>` sections have `<h3>` subsections.
B The structure is incorrect because the `<h3>` tag "Breakfast Ideas" is a subsection of "Tip 2: Eat Balanced Meals", which is valid, but the hierarchy is broken because there is no `<h3>` under "Tip 1" or "Tip 3".
C The structure is correct because all headings follow a logical hierarchy without skipping levels.
D The structure is incorrect because `<h3>` should not be used under `<h2>`; it should be a new `<h2>` section.

Answers and explanations are in the Veda app.

Q199. A student submits the following HTML for a school project: ```html <h1>My Favorite Books</h1> <h2>Fiction</h2> <p>I enjoy fiction books.</p> <h4>Science Fiction</h4> <p>Books about future technology.</p> <h4>Fantasy</h4> <p>Books with magic and mythical creatures.</p> <h2>Non-Fiction</h2> <p>I also read non-fiction.</p> <h3>History</h3> <p>Books about past events.</p> ``` Which of the following best analyzes the issues in this code?

Advanced
A The code has a major issue: `<h2>` should not be used twice; the page should have only one `<h2>`.
B The code has two issues: heading levels are skipped (from `<h2>` to `<h4>` under "Fiction") and the hierarchy is inconsistent because `<h3>` is used under "Non-Fiction" while `<h4>` is used under "Fiction".
C The only issue is that `<h4>` is used instead of `<h3>` under "Fiction", but otherwise the structure is fine.
D The code is correct because `<h4>` and `<h3>` are both valid heading levels and the content is well-organized.

Answers and explanations are in the Veda app.

Q200. Consider the following HTML snippet: ```html <form action="/submit" method="post"> <input type="text" name="username"> <input type="text" name="email"> <input type="button" value="Go"> </form> ``` A developer expects that clicking the "Go" button will send the form data to the server. However, nothing happens. Which minimal change would make the form submit correctly?

Advanced
A Set the `action` attribute to a valid URL.
B Wrap the inputs in a `<fieldset>` element.
C Change the `<input type="button">` to `<input type="submit">`.
D Add a `name` attribute to the `<form>` element.

Answers and explanations are in the Veda app.

Make your own

Your notes can be a kit like these

Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free to start, in more than 40 languages.

  • Chapter notes
  • Flashcards
  • Practice MCQs
  • Scored tests
  • Paper Solver

Get Veda free See what students get

Free to start · Android app and web · More than 40 languages