wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Midterm Examination

Total questions: 80

Worksheet time: 56mins

Name
Class
Date
1.

Which of the following best describes the core functionality of a Progressive Web Application (PWA)?

a)

It requires a stable internet connection to function correctly

b)

It combines the best features of web and mobile apps, providing offline functionality and push notifications

c)

It uses server-side scripting to generate content dynamically

d)

It relies solely on traditional HTML and CSS for rendering

2.

In a headless CMS architecture, how is the content delivered to the front end?

a)

Through pre-rendered HTML pages hosted on a server

b)

By dynamically generating pages using JavaScript libraries

c)

Via APIs that deliver content to multiple platforms

d)

Through traditional templates with embedded content

3.

Which of the following scenarios would NOT be suitable for a static website?

a)

A portfolio showcasing a designer’s work

b)

An e-commerce website with frequent product updates

c)

A landing page for a promotional event

d)

A company’s informational blog without frequent changes

4.

What is the primary reason why Web 2.0 applications revolutionized user engagement compared to Web 1.0?

a)

They allowed users to create, share, and interact with content

b)

They improved website loading speed and efficiency

c)

They enabled websites to be accessed offline

d)

They introduced mobile-first design practices

5.

In a dynamic website, how are updates to content typically handled?

a)

Manually changing the HTML and CSS files

b)

By retrieving data from a database and dynamically generating pages

c)

Through a CDN that caches and updates content

d)

Using a website builder to edit static content

6.

Which component is critical in ensuring navigation consistency across all pages of a website?

a)

Call to Action

b)

Header and Navigation Menu

c)

Sidebar

d)

Footer

7.

What is the primary reason for using responsive web design (RWD) in modern websites?

a)

To improve website loading speed

b)

To ensure compatibility across different devices and screen sizes

c)

To enhance SEO rankings

d)

To increase user interaction with multimedia content

8.

Which of the following accurately differentiates static websites from dynamic websites?

a)

Static websites are faster and easier to host, while dynamic websites allow content updates and user interaction

b)

Dynamic websites are more secure than static websites

c)

Static websites offer greater customization than dynamic websites

d)

Dynamic websites do not require server-side scripting

9.

Which of the following best explains why AI-powered recommendation systems are becoming essential for modern websites?

a)

They analyze user behavior to deliver personalized content and improve engagement.

b)

They ensure faster website loading times.

c)

They reduce the risk of cyberattacks by monitoring traffic.

d)

They automate website maintenance and content updates.

10.

Which of the following is a major challenge when implementing dynamic websites with heavy database interaction?

a)

Limited design flexibility

b)

Slower page load times due to real-time data processing

c)

Difficulty in managing multimedia content

d)

Lack of user interaction capabilities

11.

Which of the following is true about the <h1> to <h6> elements?

a)
  1. <h1> is the largest heading and is used only once on a webpage.

b)

<h1> to <h6> decrease in importance and size from <h1> to <h6>.

c)

All heading tags display content with the same size and importance.

d)
  1. <h6> is used to define the most important heading in a webpage.

12.

Which of the following will correctly display a highlighted word inside a paragraph?

a)

<p><highlight>This is important.</highlight></p>

b)
  1. <p><b>Important text.</b></p>

c)
  1. <p><mark>This is important.</mark></p>

d)
  1. <p><mark>This is important.<mark></p>

13.

You want to create a paragraph with text in blue color and bold the word 'HTML'. Which of the following is correct?

a)

<p style="font-color: blue;"><b>HTML</b> is fun!</p>

b)
  1. <p style="color: blue;">HTML is fun!</b></p>

c)
  1. <p style="color: blue;"> <b>HTML</b> is fun!</p>

d)
  1. <p style="text-color: blue;">HTML <b>is fun!</b></p>

14.

What is the correct way to hide a piece of HTML content without deleting it from the code?

a)

<hide>This content is hidden.</hide>

b)
  1.  /* This content is hidden. */ 

c)
  1. <!-- This content is hidden. --> 

d)
  1. <invisible>This content is hidden.</invisible>

15.

How does the <q> element differ from the <blockquote> element?

a)

<q> is used for short quotes and adds quotation marks automatically, while <blockquote> is used for long quotes.

b)

<q> is a container for short quotes, while <blockquote> requires CSS to style quotes.

c)

<q> creates inline quotes, while <blockquote> creates block-level quotes with indentation.

d)

Both elements behave identically but are used for different sources.

16.

What is the correct syntax to create a paragraph where the text is italic and has a yellow background color?

a)

<p style="background: yellow; font-style: italic;">This is text</p>

b)

<p style="background-color: yellow; font-style: italic;">This is text</p>

c)

<p style="bg-color: yellow; italic;">This is text</p>

d)

<p style="color: yellow; italic: true;">This is text</p>

17.

Which HTML tag correctly defines an abbreviation and provides additional information on hover?

a)

<abbr title="HyperText Markup Language">HTML</abbr>

b)

<cite title="HyperText Markup Language">HTML</cite>

c)

<address title="HyperText Markup Language">HTML</address>

d)

<bdo title="HyperText Markup Language">HTML</bdo>

18.

Consider the following code: 

<p>Water is written as H<sub>2</sub>O.</p>   

      <p>10 squared is written as 10<sup>2</sup>.</p> 

       What will be displayed on the webpage? 

a)

H2O and 10^2 in a normal line

b)

H₂O and 10² with subscript and superscript formatting

c)
  1.  H<sub>2</sub>O and 10<sup>2</sup> as plain text 

d)

An error message due to incorrect tag usage

19.

Which HTML element is best suited for quoting a block of text from another source?

a)

<q>

b)

<cite>

c)

<blockquote>

d)

<quote>

20.

Which of the following statements is true about using an <a> tag to link to a bookmark within the same page?

a)

The href attribute should start with a / followed by the id of the target element.

b)

You must use the name attribute instead of id for modern browsers.

c)

The href attribute must contain # followed by the target element's id value.

d)

Adding a bookmark requires a closing tag in the link.

21.

When using a background image for a web page, which CSS property ensures that the background image covers the entire element while maintaining its proportions?

a)

background-attachment: scroll

b)

background-repeat: repeat

c)

background-size: cover

d)

background-position: center

22.

What happens if the alt attribute is missing or left empty in an <img> tag and the image fails to load?

a)

The browser will automatically use the image’s file name as a fallback.

b)

The browser will display a broken image icon with no alternate text.

c)

The browser will display a blank space where the image should be.

d)

The browser will replace the image with a default placeholder.

23.

Which is the correct syntax to create a link that jumps to a bookmark called section2 on another page named about.html?

24.

To prevent a background image from repeating in both directions, which CSS property should you apply?

a)

background-size: contain

b)

background-repeat: no-repeat

c)

background-attachment: fixed

d)

background-position: center

25.

You need to add a comment in your HTML code to describe the section of a webpage. Which of the following will achieve this?

a)

<!-- This is a comment --!>

b)
  1. <-- This is a comment --!>

c)

<-- This is a comment -->

d)

<!-- This is a comment -->

26.

What is the correct way to specify a background image that stretches to cover 100% width and 100% height of the body?

a)

background: stretch url('image.jpg') 100% 100%;

b)

background-image: url('image.jpg'); background-stretch: 100% 100%;

c)

background-image: url('image.jpg'); background-size: 100% 100%;

d)

background-img: url('image.jpg') stretch 100%;

27.

Which of the following correctly describes the behavior of an external image URL used in an <img> tag?

a)

The browser will load the image immediately, ignoring any errors.

b)

If the image is too large, the browser automatically resizes it.

c)

External images load faster than local images.

d)

External images might fail if the server is down or the URL is invalid.

28.

To create a clickable button that links to another page and maintains its button-like appearance, which is the best approach?

a)

<a href="page.html" class="button">Click Me</a> with appropriate CSS styling

b)
  1. <button href="page.html">Click Me</button>

c)

<input type="button" link="page.html" value="Click Me">

29.

Which of the following CSS properties can make a table's borders into a single border, eliminating the default space between adjacent cells?

a)

border-spacing

b)

border-collapse

c)

border-style

d)

collapse-border

30.

What is the primary difference between using the class attribute and the id attribute in HTML?

a)

id is case-insensitive, while class is case-sensitive.

b)

class can be used only once, while id can be used multiple times.

c)

Both class and id can be used interchangeably.

d)

class can be applied to multiple elements, while id must be unique in a document.

31.

Which of the following correctly sets an image as a clickable link that opens a new tab?

a)

<a target="_blank"><img src="pic.jpg"></a>

b)

<a href="https://example.com" target="_blank"><img src="pic.jpg" alt="Example"></a>

c)

<img src="pic.jpg" href="https://example.com" target="_blank">

d)

<a img="pic.jpg" href="https://example.com" target="_blank"></a>

32.

In HTML, how can you float an image to the left and allow text to wrap around it?

a)
  1. <img src="pic.jpg" float="left"> 

b)
  1. <img src="pic.jpg" style="wrap-left"> 

c)
  1. <img src="pic.jpg" style="float:left;"> 

d)
  1. <img src="pic.jpg" text-align="left">

33.

In an HTML table, which of the following will correctly merge three rows into a single cell?

a)
  1. <td rowspan="2">

b)
  1. <td rowspan="3">

c)
  1. <th colspan="3">

d)
  1. <td colspan="3">

34.

What happens if two <div> elements with display: inline-block are placed next to each other, but no margin or padding is defined?

a)
  1. A small gap will appear between them due to inline spacing.

b)
  1. They will collapse and occupy the same space.

c)
  1. They will automatically stack on top of each other.

d)
  1. The second <div> will move to a new line.

35.

When using :nth-child(even) to apply zebra stripes to a table, what will happen if the selector is applied to the <th> elements instead of <tr>?

a)
  1. The table headers will be striped instead of the rows.

b)
  1. The styling will be ignored by the browser.

c)
  1. All rows and columns will be styled uniformly.

d)
  1. The :nth-child() selector is invalid for <th> elements.

36.

In an iframe, which of the following will remove the default border without using inline CSS?

a)
  1. <iframe border="0">

b)
  1. <iframe style="border: none;">

c)
  1. <iframe no-border>

d)
  1. <iframe border="none">

37.

Which HTML tag is used to create a definition list where the terms and their descriptions are aligned together?

a)
  1. <dl>

b)
  1. <ul>

c)
  1. <dt>

d)
  1. <dd>

38.

Which of the following will successfully hide an entire column in a table using the <colgroup> element?

a)
  1. <colgroup hide="true">

b)
  1. <col visibility="none">

c)
  1. <col style="visibility: collapse;">

d)
  1. <colgroup display="none">

39.

When using the rowspan attribute in an HTML table, which of the following statements is TRUE?

a)
  1. rowspan="0" will merge the current cell with all cells below it.

b)
  1. rowspan merges the current cell with the specified number of rows below it. 

c)
  1. rowspan automatically calculates the number of rows to merge based on the content. 

d)
  1. Using rowspan on a <th> element will apply to all header rows.

40.

Which of the following correctly identifies the difference between an id and a class in HTML?

a)
  1. class can be applied only once, while id can be reused.

b)
  1. id must be unique per document, while class can be applied multiple times.

c)
  1. Both id and class can be reused multiple times.

d)
  1. id can target multiple elements, while class targets a single element.

41.

When using the id attribute for bookmarks, what must the corresponding hyperlink reference include?

a)
  1. The full file path of the HTML document

b)
  1. A hash (#) followed by the ID name

c)
  1. The class name of the element

d)
  1. The name attribute of the element

42.

Which of the following is true about external images in HTML?

a)
  1. They require an absolute URL in the src attribute

b)
  1. They always load faster than local images

c)
  1. They cannot be displayed unless embedded in a <figure> tag

d)
  1. They do not support alt attributes

43.

What happens when an image is placed inside an <a> tag?

a)
  1. The image becomes a clickable link

b)
  1. The image is hidden from the user

c)
  1. The image cannot have an alt attribute

d)
  1. The image will float automatically

44.

What CSS property should be used to prevent a background image from repeating?

a)
  1. background-size: contain;

b)
  1. background-attachment: fixed;

c)
  1. background-repeat: no-repeat;

d)
  1. background-align: center;

45.

When specifying a background image for the entire page, which element should the CSS rule target?

a)

body

b)

html

c)

main

d)

section

46.

If an image fails to load, which attribute will be displayed instead?

a)

alt

b)
  1. title

c)

href

d)

id

47.

Which CSS property is used to make a background image cover the entire element while maintaining its aspect ratio?

a)
  1. background-size: cover;

b)
  1. background-repeat: no-repeat;

c)
  1. background-attachment: fixed;

d)
  1. background-position: center;

48.

If you set background-size: 100% 100%;, what is the likely outcome?

a)
  1. The image may stretch and become distorted

b)
  1. The image will repeat itself to fill the space

c)
  1. The image will be cropped

d)
  1. The image will maintain its original size

49.

What is the default behavior of background-repeat?

a)
  1. The background image repeats both horizontally and vertically

b)
  1. The background image does not repeat

c)
  1. The background image repeats horizontally only

d)
  1. The background image is centered and does not repeat

50.

If an image is stored in a folder named "assets" within the project directory, what is the correct way to reference it?

a)
  1. <img src="assets/image.jpg" alt="Sample">

b)
  1. <img src="/image.jpg" alt="Sample">

c)
  1. <img src="//assets/image.jpg" alt="Sample">

d)
  1. <img src="http://assets/image.jpg" alt="Sample">

51.

Which of the following statements about the <img> tag is FALSE?

a)
  1. It does not have a closing tag

b)
  1. The src attribute is required

c)
  1. The width attribute is required

d)
  1. The alt attribute is used for accessibility.

52.

What does background-attachment: fixed; do?

a)
  1. Prevents the background image from loading

b)
  1. Keeps the background image static while scrolling

c)
  1. Ensures the background image repeats across the entire page

d)
  1. Stretches the background image to fit the screen

53.

What happens if an <img> tag does not have a src attribute?

a)
  1. The image is displayed with a placeholder

b)
  1. The browser automatically searches for a default image

c)
  1. The page does not load at all

d)
  1. A broken image icon appears

54.

What is the correct way to link to a bookmark on a different page?

a)
  1. <a href="#bookmark">

b)
  1. <a href="page.html#bookmark">

c)
  1. <a href="bookmark.html#">

d)
  1. <a id="bookmark">

55.

Which method should be used to ensure an image is responsive within a flexible layout?

a)

width: 100%; height: auto;

b)
  1. width: auto; height: 100%;

c)
  1. width: fixed; height: auto;

d)
  1. width: 500px; height: 500px;

56.

Which tag is used to create a bookmark within a webpage?

a)
  1. <bookmark>

b)
  1. <h2 id="section1">

c)
  1. <a href="#section1">

d)
  1. <div id="#section1">

57.

Which CSS property is necessary to ensure a background image fills the entire viewport and does not scroll with the page?

a)
  1. background-size: contain;

b)
  1. background-size: cover; background-attachment: fixed;

c)
  1. background-repeat: no-repeat; background-align: center;

d)

background-stretch: full;

58.

Which of the following statements about using an image as a hyperlink is TRUE?

a)
  1. The <img> tag must have a title attribute to be clickable

b)
  1. The <img> tag must be wrapped inside an <a> tag to function as a link

c)
  1. The <img> tag automatically acts as a link if it has an alt attribute

d)
  1. The <img> tag cannot be used inside an <a> tag

59.

Which attribute specifies the URL of the document that is embedded inside an iframe?

a)

src

b)

href

c)

name

d)

target

60.

Which CSS property controls the border thickness, style, and color of an iframe?

a)

border

b)
  1. border-width

c)

outline

d)
  1. frame-style

61.

Which attribute is used to make a table header span across multiple columns?

a)

rowspan

b)

span

c)

colspan

d)

coldwidth

62.

Which of the following correctly applies a zebra stripe to table rows?

a)
  1. table:nth-child(even)

b)
  1. tr:nth-last-child(odd)

c)
  1. tr:alternate(even)

d)
  1. tr:nth-child(even)

63.

Which property allows you to align multiple <div> elements side by side without using float?

a)
  1. display: inline;

b)
  1. position: relative;

c)
  1. justify-content: space-between;

d)
  1. display: inline-block;

64.

Which of the following is NOT a correct way to set an image's dimensions?

a)
  1. <img src="image.jpg" width="300" height="200">

b)
  1. <img src="image.jpg" style="width: 300px; height: 200px;">

c)
  1. <img src="image.jpg" size="300x200">

d)
  1. <img src="image.jpg" alt="Image" width="50%">

65.

What is the primary reason to use the alt attribute in an <img> tag?

a)
  1. To provide a caption for the image

b)
  1. To improve the image's resolution

c)
  1. To help the image for accessibility and in case of loading failure

d)
  1. To link the image to another webpage

66.

How do you remove the default border around an iframe?

a)
  1. frameborder="0"

b)
  1. border="none"

c)
  1. style="border: none;"

d)
  1. border="0"

67.

Which of the following is true about an HTML table header element <th>?

a)
  1. It always centers content regardless of CSS settings.

b)
  1. It can span multiple rows but not columns.

c)
  1. It uses bold and centered text by default.

d)
  1. It cannot be styled using CSS.

68.

Which of the following correctly hides a table column using <colgroup>?

a)
  1. <col style="visibility: hidden;">

b)
  1. <col span=”3”>

c)
  1. <col style="visibility: collapse;">

d)
  1. <colgroup display="none">

e)
  1. <colgroup collapse="yes">

69.

How do you create a borderless iframe in HTML?

a)
  1. Add border="0"

b)
  1. Use style="border-width: 0;"

c)
  1. Add style="border: none;"

d)
  1. iframe border-collapse: none;

70.

What is the correct way to access all elements of a specific class using JavaScript?

a)
  1. document.getElementsByClassName("example");

b)
  1. document.getElementById("example");

c)
  1. document.querySelector(".example");

d)
  1. document.getElementsByTagName("example");

71.

Which element is used to define a description list in HTML?

a)
  1. <list>

b)
  1. <dl>

c)
  1. <dt>

d)
  1. <dd>

72.

Which CSS property can change the width between table cells?

a)

padding

b)

margin

c)
  1. width

d)
  1. border-spacing

73.

What is the purpose of the <colgroup> element in an HTML table?

a)
  1. To define a group of rows.

b)
  1. To style or apply attributes to specific columns of a table.

c)
  1. To merge multiple cells into one.

d)
  1. To remove spacing between table cells.

74.

Which HTML list element is used for an unordered list?

a)
  1. <ol>

b)
  1. <li>

c)
  1. <dl>

d)
  1. <ul>

75.

How do you define a term in a description list?

a)
  1. <dt>

b)
  1. <dd>

c)
  1. <dl>

d)
  1. <li>

76.

What is the correct way to change the starting number in an ordered list?

a)
  1. <ol num="3">

b)
  1. <ol begin="3">

c)
  1. <ol start="3">

d)
  1. <ol value="3">

77.

Which CSS property should you use to create a grid layout with rows and columns in a <div>?

a)
  1. display: flex;

b)
  1. position: grid;

c)
  1. display: grid;

d)
  1. grid-template: auto;

78.

When nesting HTML lists, which of the following is correct?

a)

Nest an <ul> or <ol> directly inside an <li> element.

b)

Place nested lists inside a <div> element for structure.

c)

Use <li> to enclose both parent and child lists.

d)

Add a nested <ul> or <ol> inside an <li> element.

79.

What happens if you try to apply the same id to multiple elements in an HTML document?

a)
  1. The browser ignores the duplicate IDs and applies styles to the first one only.

b)
  1. All elements with the same id will get the specified styles, but JavaScript will only access the first one.

c)
  1. It triggers a JavaScript error, preventing the page from loading correctly.

d)
  1. It creates an invalid HTML document, which may cause unpredictable results.

80.

What is the primary difference between using the class attribute and the id attribute in HTML?

a)
  1. id is case-insensitive, while class is case-sensitive.

b)
  1. class can be used only once, while id can be used multiple times.

c)
  1. Both class and id can be used interchangeably.

d)
  1. class can be applied to multiple elements, while id must be unique in a document.