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 a tag?

    _main

    Correct!


  • _self

    _top

    _parent

  • 3. 

    What is the purpose of the controls attribute in the audio element?

    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 link and script elements in HTML?

    link is for JavaScript files, and script is for CSS files.

    link is used to add styles from an external CSS file, while script is used to run JavaScript code.

    Correct!

    script is for adding styles, and link is for running JavaScript.

    Both link and script are used to style web pages.

  • 7. 

    Which of the following statements about HTML classes and IDs is incorrect?

    The rel attribute 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:image property 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 h1 to h6.

    The text size decreases from h1 to h6.

    Correct!

    The text size remains the same for all heading elements.

    h3 is larger than h2.

  • 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

    _self

    Correct!

    _blank

    _top

  • 13. 

    What is the purpose of the em element 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 strong element 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 figure and figcaption elements in HTML?

    There is no difference; both are used for the same purpose.

    figure groups related content like images or diagrams, while figcaption provides a caption for that content

    Correct!

    figcaption must always be placed outside the figure element.

    figure is used for captions, while figcaption is 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 body section of HTML.

    Open Graph tags are only used for SEO and have no effect on social media.

    The og:title property 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 loop attribute do in the audio element?

    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!