wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

HTML -SHS2025

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

What is the first logical step you should take to start writing an HMTL document in your development environment? Select the best answer.

a)

Create a file with the .html extension.

b)

Write the <html> tag and define the html version used in your document

c)

set up a server and load a .css file to it.

d)

Declare the document's character encoding.

2.

Which section of an HTML document typically contains metadata like keywords and descriptions?

a)

<head>

b)

<body>

c)

<footer>

d)

<header>

3.

Which HTML element is used to define the document's character encoding?

a)

<meta>

b)

<charset>

c)

<doctype>

d)

<html>

4.

Which of the following is considered block-level elements in HTML5?

a)

<div>

b)

<span>

c)

<img>

d)

<br>

5.

Which HTML code correctly creates a nested list with ordered and unordered lists?

a)

<ol>
<li> Item One <ul>
<li> Subitem A </li>
</ul>
</li>
<li> Item Two </li>
</ol>

b)

<ol> <li>Item One
<li> Subitem A </li>
</li>
<li> Item Two</li>
</ol>

c)

<ul> <li> Item One <ol>
<li> Subitem 1 </li> </ol>
</li><li> Item Twi </li>
</ul>

d)

<ul> <li> Item One </li>
<ul><li> SubItem A </li>
</ul><li> Item Two </li>
</ul>

6.

What is the purpose of the srcset attribute in this <img> tag?

a)

to define multiple image sources for different viewport widths.

b)

to set multiple sources for the same image to load faster.

c)

to specify different images to be displayed on hover.

d)

to provide a fallback image if the original fails to load.

7.

which of the following correctly applies a red color to the text of a paragraph using inline styling?

a)

<p style = "color: red;"> this text is red. </p>

b)

<p style = "text-color:red;"> this text is red. </p>

c)

<p color="red"> this text is red. </p>

d)

<p font="red"> this text is red. </p>

8.

Which snippet correctly changes the background color of all <div> elements to blue using internal stylesheet?

a)

div {background-color:blue;}

b)

div {color:blue;}

c)

div {background:blue;}

d)

#div {background-color:blue;}

9.

how do you correctly set the font size to 16 pixels and the font family to Arial in a CSS rule?

a)

font-size: 16px;
font-family: Arial;

b)

font-size: 16rem;
font-family: 'Arial';

c)

font-size: 16px;
font: Arial;

d)

font-size: 16px;
font-family: 'Arial';

10.

Which statement is true regarding the use of <span> and <div>?

a)

<div> can contain block-level elements, whereas <span> is used for inline styling.

b)

<span> is used for block-level contend, while <div> is for inline content.

c)

<span> and <div> are interchangeable and have no difference in styling.

d)

<div> is used to style text, while <span> is for larger section of HTML.

11.

How do you select elements with custom-made class
highlight-this
in a CSS stylesheet?

a)

.highlight-this { color:yellow; }

b)

highlight-this { color:yellow; }

c)

#highlight-this { color:yellow; }

d)

highlight-this { color: yellow; }

12.

What is the main difference between using class and id attributes in HTML?

a)

The class attribute can be applied to multiple elements, while the id attribute must be unique to a single element.

b)

the class attribute is used exclusively for styling, while the id attribute is used for both styling and Javascript

c)

the id attribute is used to style elements when classes are not available.

d)

the class attribute cannot be used with the <div> element, while the id attribute can.

13.

Which syntax correctly applies two separate classes to a single HTML element?

a)

<div class="class1 class2"> Content </div>

b)

<div class="class1, class2"> Content </div>

c)

<div class="class1" class="class2"> Content </div>

d)

<div classes="class1 class2"> Content </div>

14.

What does the title attribute provide when used within an HTML element?

a)

A tooltip when the mouse hovers over the elements

b)

a unique identifier for CSS and JavaScript.

c)

A structural division for the document.

d)

An inline style declaration.

15.

Which HTML5 element is used to represent a generic container without any additional semantic meaning?

a)

<div>

b)

<article>

c)

<mai>

d)

<aside>

16.

How should the following snippet be corrected to display a less than symbol?
<p> Our prices are < than ever! </p>

a)

Replace < with &lt;

b)

Add quotes around <

c)

Replace < with \<

d)

Wrap < in <!-- and -->

17.

What is the correct way to create a hyperlink in HTML?

a)

<a href="https://www.example.com">Visit Example</a>

b)

<url href="https://www.example.com">Visit Example</url>

c)

<link href="https://www.example.com">Visit Example</link>

d)

<hyperlink href="https://www.example.com">Visit Example</hyperlink>

18.

Which HTML element is used to define a navigation section?

a)

<link>

b)

<menu>

c)

<navigation>

d)

<nav>

19.

How do you correctly include an external CSS file in an HTML document?

a)

<css href="styles.css">

b)

<script src="styles.css">

c)

<style src="styles.css">

d)

<link rel="stylesheet" href="styles.css">

20.

Which HTML element is used to create a footer for a document?

a)

<footer>

b)

<bottom>

c)

<end>

d)

<section>

21.

What is the purpose of the alt attribute in an <img> tag?

a)

To define the image's dimensions.

b)

To specify the image's source URL.

c)

To add a caption below the image.

d)

To provide alternative text for the image if it cannot be displayed.

22.

Which HTML tag is used to define a section that is independent and self-contained?

a)

<div>

b)

<section>

c)

<group>

d)

<article>

23.

Which HTML element is used to create a section that can be reused across multiple pages?

a)

<include>

b)

<template>

c)

<component>

d)

<section>

24.

What is the correct way to add a comment in an HTML document?

a)

<!-- This is a comment -->

b)

<comment> This is a comment </comment>

c)

<# This is a comment #>

d)

<-- This is a comment <!--

25.

Which attribute is used to specify the character encoding for an HTML document?

a)

http-equiv

b)

charset

c)

encoding

d)

meta