Basic HTML Quiz
To pass the quiz, you must correctly answer at least 18 of the 20 questions below.
1.
Which of the following is NOT a correct statement about absolute and relative paths?
Absolute paths start from the root directory, while relative paths depend on the location of the current file.
Relative paths cannot use
..to move up directories, but absolute paths can.Correct!
Relative paths are shorter and more flexible for linking within a website, while absolute paths include the full URL.
Both absolute and relative paths can be used to link to files within the same website.
2.
Which of the following is NOT a valid target attribute value in an
atag?_mainCorrect!
_self_top_parent3.
What is the purpose of the
controlsattribute in theaudioelement?It specifies the audio file’s source URL.
It adds built-in playback controls like play, pause, and volume adjustment.
Correct!
It defines the audio file format for the browser to use.
It automatically starts the audio when the page loads.
4.
Which of the following elements improves SEO by providing a brief description of the web page?
<meta description="describe" content="Discover expert tips and techniques for gardening in small spaces, choosing the right plants, and maintaining a thriving garden." /><meta name="desc" content="Discover expert tips and techniques for gardening in small spaces, choosing the right plants, and maintaining a thriving garden." /><meta name="description" content="Discover expert tips and techniques for gardening in small spaces, choosing the right plants, and maintaining a thriving garden." />Correct! (above)
<meta description="description" content="Discover expert tips and techniques for gardening in small spaces, choosing the right plants, and maintaining a thriving garden." />5.
What does
<meta charset="utf-8" />do?Specifies the title of the webpage.
Sets the language of the webpage to English.
Defines the character encoding to ensure proper text display.
Correct!
Links an external CSS stylesheet.
6.
What is the difference between
linkandscriptelements in HTML?linkis for JavaScript files, andscriptis for CSS files.linkis used to add styles from an external CSS file, whilescriptis used to run JavaScript code.Correct!
scriptis for adding styles, andlinkis for running JavaScript.Both
linkandscriptare used to style web pages.7.
Which of the following statements about HTML classes and IDs is incorrect?
The
relattribute defines the relationship between the linked resource and the HTML document.A class name can be used multiple times throughout an HTML document.
The
og:imageproperty is used to specify the image displayed in social media posts.ID names cannot contain underscores and must be unique.
Correct!
8.
Which of the following statements about HTML heading elements is true?
The text size increases from
h1toh6.The text size decreases from
h1toh6.Correct!
The text size remains the same for all heading elements.
h3is larger thanh2.9.
Which statement is incorrect about HTML elements?
Some codebases include a forward slash (/) inside void elements.
HTML elements are the basic building blocks of a webpage.
Void elements contain content and only have a start tag.
Correct!
A boolean attribute is one that works simply by being present or absent in a tag.
10.
Which of the following statements about void elements in HTML is true?
The forward slash / is mandatory for self-closing void elements in all versions of HTML.
A void element must always include a forward slash / before closing.
Both
<img>and<img/>are acceptable in modern HTML.Correct!
A void element should never include a forward slash /.
11.
What is the primary purpose of comments in programming?
To store temporary data within the code.
To make the code run faster.
To change how the browser displays content.
To leave notes for yourself and other developers in the code.
Correct!
12.
Which target attribute opens a link in the same browsing context as the current one?
_parent_selfCorrect!
_blank_top13.
What is the purpose of the
emelement in HTML?To highlight important text by making it italic.
Correct!
To underline words for emphasis.
To make text bigger.
To change the text color.
14.
What does the
strongelement do in HTML?Makes text bold to show importance.
Correct!
Changes the text color.
Underlines the text.
Increases the font size.
15.
What is the main difference between the
figureandfigcaptionelements in HTML?There is no difference; both are used for the same purpose.
figuregroups related content like images or diagrams, whilefigcaptionprovides a caption for that contentCorrect!
figcaptionmust always be placed outside thefigureelement.figureis used for captions, whilefigcaptionis used to group related content like images or diagrams.16.
Why are HTML entities used?
To add styling to text.
To represent reserved characters like
<and&in HTML.Correct!
To increase the font size of special characters.
To create hyperlinks in a webpage.
17.
Which of the following statements about Open Graph tags is correct?
Open Graph tags are used to style a webpage with CSS.
Open Graph tags must be placed inside the
bodysection of HTML.Open Graph tags are only used for SEO and have no effect on social media.
The
og:titleproperty sets the title that appears when content is shared on social media.Correct!
18.
Which of the following statements about image formats is incorrect?
PNG and JPG are the best formats for optimized images today.
Correct!
SVG images can scale without losing quality.
Compression helps reduce image file sizes.
WEBP and AVIF are better for modern image optimization.
19.
What does the
loopattribute do in theaudioelement?Slows down the audio playback.
Stops the audio after one play.
Plays the audio once.
Repeats the audio continuously.
Correct!
20.
Which of the following best describes an HTML boilerplate?
A browser plugin that speeds up webpage loading.
A special tool used by web developers to add watermarks to documents.
A coding framework exclusively for animations in HTML.
A predefined template containing essential HTML structure for web development.
Correct!