120 of this kit's 245 questions, laddered from warm-up to topper-level, each with its answer and the reasoning. The rest are in the app.
Warm-up
· 75 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
Answers and explanations are in the Veda app.
Q10.
The `<head>` and `<body>` elements are siblings, both nested directly inside the `<html>` element.
Beginner
Answers and explanations are in the Veda app.
Q11.
Placing `<link>` tags for CSS in the `<body>` is a best practice for performance.
Beginner
Answers and explanations are in the Veda app.
Q12.
A valid HTML document can have multiple `<body>` elements.
Beginner
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
Answers and explanations are in the Veda app.
Q34.
HTML tag names are case-insensitive, but lowercase is the convention.
Beginner
Answers and explanations are in the Veda app.
Q35.
Using semantic HTML tags can improve a website's search engine ranking.
Beginner
Answers and explanations are in the Veda app.
Q36.
The `<img>` tag requires a closing `</img>` tag.
Beginner
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
Answers and explanations are in the Veda app.
Q60.
The `<head>` element contains the visible content of a web page.
Beginner
Answers and explanations are in the Veda app.
Q61.
Using semantic HTML tags can improve a website's search engine ranking.
Beginner
Answers and explanations are in the Veda app.
Q62.
The `<br>` tag requires a closing tag like `</br>`.
Beginner
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.
Building up
· 33 questions
Q76.
Why is the `<title>` tag important for SEO?
Intermediate
Answers and explanations are in the Veda app.
Q77.
Where should CSS stylesheets be linked in an HTML document and why?
Intermediate
Answers and explanations are in the Veda app.
Q78.
Why are `<script>` tags often placed at the end of the `<body>`?
Intermediate
Answers and explanations are in the Veda app.
Q79.
What is quirks mode and what causes it?
Intermediate
Answers and explanations are in the Veda app.
Q80.
What does the `lang` attribute on the `<html>` tag do?
Intermediate
Answers and explanations are in the Veda app.
Q81.
What happens if you place `<title>` or `<link>` tags inside the `<body>`?
Intermediate
Answers and explanations are in the Veda app.
Q82.
In what order does a browser process an HTML document?
Intermediate
Answers and explanations are in the Veda app.
Q83.
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.
Q84.
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.
Q85.
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.
Q86.
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.
Q87.
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.
Q88.
What is nesting in HTML?
Intermediate
Answers and explanations are in the Veda app.
Q89.
What is semantic HTML?
Intermediate
Answers and explanations are in the Veda app.
Q90.
Why is semantic HTML important for accessibility?
Intermediate
Answers and explanations are in the Veda app.
Q91.
What happens if you forget a closing tag in HTML?
Intermediate
Answers and explanations are in the Veda app.
Q92.
What is the tree structure of HTML elements?
Intermediate
Answers and explanations are in the Veda app.
Q93.
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.
Q94.
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.
Q95.
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.
Q96.
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.
Q97.
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.
Q98.
What is the Document Object Model (DOM)?
Intermediate
Answers and explanations are in the Veda app.
Q99.
What is semantic HTML?
Intermediate
Answers and explanations are in the Veda app.
Q100.
Why should you avoid using `<font>` or `<center>` tags in modern HTML?
Intermediate
Answers and explanations are in the Veda app.
Q101.
How does HTML help with web accessibility?
Intermediate
Answers and explanations are in the Veda app.
Q102.
What is the difference between HTML and CSS?
Intermediate
Answers and explanations are in the Veda app.
Q103.
Name three places where HTML is used besides web pages.
Intermediate
Answers and explanations are in the Veda app.
Q104.
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.
Q105.
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.
Q106.
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.
Q107.
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.
Q108.
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.
Topper level
· 12 questions
Q109.
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.
Q110.
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.
Q111.
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.
Q112.
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.
Q113.
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.
Q114.
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.
Q115.
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.
Q116.
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.
Q117.
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.
Q118.
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.
Q119.
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.
Q120.
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.