NEW
Font size
WorksheetsMidterm Examination
Total questions: 80
Worksheet time: 56mins
Which of the following best describes the core functionality of a Progressive Web Application (PWA)?
It requires a stable internet connection to function correctly
It combines the best features of web and mobile apps, providing offline functionality and push notifications
It uses server-side scripting to generate content dynamically
It relies solely on traditional HTML and CSS for rendering
In a headless CMS architecture, how is the content delivered to the front end?
Through pre-rendered HTML pages hosted on a server
By dynamically generating pages using JavaScript libraries
Via APIs that deliver content to multiple platforms
Through traditional templates with embedded content
Which of the following scenarios would NOT be suitable for a static website?
A portfolio showcasing a designer’s work
An e-commerce website with frequent product updates
A landing page for a promotional event
A company’s informational blog without frequent changes
What is the primary reason why Web 2.0 applications revolutionized user engagement compared to Web 1.0?
They allowed users to create, share, and interact with content
They improved website loading speed and efficiency
They enabled websites to be accessed offline
They introduced mobile-first design practices
In a dynamic website, how are updates to content typically handled?
Manually changing the HTML and CSS files
By retrieving data from a database and dynamically generating pages
Through a CDN that caches and updates content
Using a website builder to edit static content
Which component is critical in ensuring navigation consistency across all pages of a website?
Call to Action
Header and Navigation Menu
Sidebar
Footer
What is the primary reason for using responsive web design (RWD) in modern websites?
To improve website loading speed
To ensure compatibility across different devices and screen sizes
To enhance SEO rankings
To increase user interaction with multimedia content
Which of the following accurately differentiates static websites from dynamic websites?
Static websites are faster and easier to host, while dynamic websites allow content updates and user interaction
Dynamic websites are more secure than static websites
Static websites offer greater customization than dynamic websites
Dynamic websites do not require server-side scripting
Which of the following best explains why AI-powered recommendation systems are becoming essential for modern websites?
They analyze user behavior to deliver personalized content and improve engagement.
They ensure faster website loading times.
They reduce the risk of cyberattacks by monitoring traffic.
They automate website maintenance and content updates.
Which of the following is a major challenge when implementing dynamic websites with heavy database interaction?
Limited design flexibility
Slower page load times due to real-time data processing
Difficulty in managing multimedia content
Lack of user interaction capabilities
Which of the following is true about the <h1> to <h6> elements?
<h1> is the largest heading and is used only once on a webpage.
<h1> to <h6> decrease in importance and size from <h1> to <h6>.
All heading tags display content with the same size and importance.
<h6> is used to define the most important heading in a webpage.
Which of the following will correctly display a highlighted word inside a paragraph?
<p><highlight>This is important.</highlight></p>
<p><b>Important text.</b></p>
<p><mark>This is important.</mark></p>
<p><mark>This is important.<mark></p>
You want to create a paragraph with text in blue color and bold the word 'HTML'. Which of the following is correct?
<p style="font-color: blue;"><b>HTML</b> is fun!</p>
<p style="color: blue;">HTML is fun!</b></p>
<p style="color: blue;"> <b>HTML</b> is fun!</p>
<p style="text-color: blue;">HTML <b>is fun!</b></p>
What is the correct way to hide a piece of HTML content without deleting it from the code?
<hide>This content is hidden.</hide>
/* This content is hidden. */
<!-- This content is hidden. -->
<invisible>This content is hidden.</invisible>
How does the <q> element differ from the <blockquote> element?
<q> is used for short quotes and adds quotation marks automatically, while <blockquote> is used for long quotes.
<q> is a container for short quotes, while <blockquote> requires CSS to style quotes.
<q> creates inline quotes, while <blockquote> creates block-level quotes with indentation.
Both elements behave identically but are used for different sources.
What is the correct syntax to create a paragraph where the text is italic and has a yellow background color?
<p style="background: yellow; font-style: italic;">This is text</p>
<p style="background-color: yellow; font-style: italic;">This is text</p>
<p style="bg-color: yellow; italic;">This is text</p>
<p style="color: yellow; italic: true;">This is text</p>
Which HTML tag correctly defines an abbreviation and provides additional information on hover?
<abbr title="HyperText Markup Language">HTML</abbr>
<cite title="HyperText Markup Language">HTML</cite>
<address title="HyperText Markup Language">HTML</address>
<bdo title="HyperText Markup Language">HTML</bdo>
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?
H2O and 10^2 in a normal line
H₂O and 10² with subscript and superscript formatting
H<sub>2</sub>O and 10<sup>2</sup> as plain text
An error message due to incorrect tag usage
Which HTML element is best suited for quoting a block of text from another source?
<q>
<cite>
<blockquote>
<quote>
Which of the following statements is true about using an <a> tag to link to a bookmark within the same page?
The href attribute should start with a / followed by the id of the target element.
You must use the name attribute instead of id for modern browsers.
The href attribute must contain # followed by the target element's id value.
Adding a bookmark requires a closing tag in the link.
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?
background-attachment: scroll
background-repeat: repeat
background-size: cover
background-position: center
What happens if the alt attribute is missing or left empty in an <img> tag and the image fails to load?
The browser will automatically use the image’s file name as a fallback.
The browser will display a broken image icon with no alternate text.
The browser will display a blank space where the image should be.
The browser will replace the image with a default placeholder.
Which is the correct syntax to create a link that jumps to a bookmark called section2 on another page named about.html?
<a href="about.html@section2">Jump to Section 2</a>
To prevent a background image from repeating in both directions, which CSS property should you apply?
background-size: contain
background-repeat: no-repeat
background-attachment: fixed
background-position: center
You need to add a comment in your HTML code to describe the section of a webpage. Which of the following will achieve this?
<!-- This is a comment --!>
<-- This is a comment --!>
<-- This is a comment -->
<!-- This is a comment -->
What is the correct way to specify a background image that stretches to cover 100% width and 100% height of the body?
background: stretch url('image.jpg') 100% 100%;
background-image: url('image.jpg'); background-stretch: 100% 100%;
background-image: url('image.jpg'); background-size: 100% 100%;
background-img: url('image.jpg') stretch 100%;
Which of the following correctly describes the behavior of an external image URL used in an <img> tag?
The browser will load the image immediately, ignoring any errors.
If the image is too large, the browser automatically resizes it.
External images load faster than local images.
External images might fail if the server is down or the URL is invalid.
To create a clickable button that links to another page and maintains its button-like appearance, which is the best approach?
<a href="page.html" class="button">Click Me</a> with appropriate CSS styling
<button href="page.html">Click Me</button>
<input type="button" link="page.html" value="Click Me">
Which of the following CSS properties can make a table's borders into a single border, eliminating the default space between adjacent cells?
border-spacing
border-collapse
border-style
collapse-border
What is the primary difference between using the class attribute and the id attribute in HTML?
id is case-insensitive, while class is case-sensitive.
class can be used only once, while id can be used multiple times.
Both class and id can be used interchangeably.
class can be applied to multiple elements, while id must be unique in a document.
Which of the following correctly sets an image as a clickable link that opens a new tab?
<a target="_blank"><img src="pic.jpg"></a>
<a href="https://example.com" target="_blank"><img src="pic.jpg" alt="Example"></a>
<img src="pic.jpg" href="https://example.com" target="_blank">
<a img="pic.jpg" href="https://example.com" target="_blank"></a>
In HTML, how can you float an image to the left and allow text to wrap around it?
<img src="pic.jpg" float="left">
<img src="pic.jpg" style="wrap-left">
<img src="pic.jpg" style="float:left;">
<img src="pic.jpg" text-align="left">
In an HTML table, which of the following will correctly merge three rows into a single cell?
<td rowspan="2">
<td rowspan="3">
<th colspan="3">
<td colspan="3">
What happens if two <div> elements with display: inline-block are placed next to each other, but no margin or padding is defined?
A small gap will appear between them due to inline spacing.
They will collapse and occupy the same space.
They will automatically stack on top of each other.
The second <div> will move to a new line.
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>?
The table headers will be striped instead of the rows.
The styling will be ignored by the browser.
All rows and columns will be styled uniformly.
The :nth-child() selector is invalid for <th> elements.
In an iframe, which of the following will remove the default border without using inline CSS?
<iframe border="0">
<iframe style="border: none;">
<iframe no-border>
<iframe border="none">
Which HTML tag is used to create a definition list where the terms and their descriptions are aligned together?
<dl>
<ul>
<dt>
<dd>
Which of the following will successfully hide an entire column in a table using the <colgroup> element?
<colgroup hide="true">
<col visibility="none">
<col style="visibility: collapse;">
<colgroup display="none">
When using the rowspan attribute in an HTML table, which of the following statements is TRUE?
rowspan="0" will merge the current cell with all cells below it.
rowspan merges the current cell with the specified number of rows below it.
rowspan automatically calculates the number of rows to merge based on the content.
Using rowspan on a <th> element will apply to all header rows.
Which of the following correctly identifies the difference between an id and a class in HTML?
class can be applied only once, while id can be reused.
id must be unique per document, while class can be applied multiple times.
Both id and class can be reused multiple times.
id can target multiple elements, while class targets a single element.
When using the id attribute for bookmarks, what must the corresponding hyperlink reference include?
The full file path of the HTML document
A hash (#) followed by the ID name
The class name of the element
The name attribute of the element
Which of the following is true about external images in HTML?
They require an absolute URL in the src attribute
They always load faster than local images
They cannot be displayed unless embedded in a <figure> tag
They do not support alt attributes
What happens when an image is placed inside an <a> tag?
The image becomes a clickable link
The image is hidden from the user
The image cannot have an alt attribute
The image will float automatically
What CSS property should be used to prevent a background image from repeating?
background-size: contain;
background-attachment: fixed;
background-repeat: no-repeat;
background-align: center;
When specifying a background image for the entire page, which element should the CSS rule target?
body
html
main
section
If an image fails to load, which attribute will be displayed instead?
alt
title
href
id
Which CSS property is used to make a background image cover the entire element while maintaining its aspect ratio?
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
If you set background-size: 100% 100%;, what is the likely outcome?
The image may stretch and become distorted
The image will repeat itself to fill the space
The image will be cropped
The image will maintain its original size
What is the default behavior of background-repeat?
The background image repeats both horizontally and vertically
The background image does not repeat
The background image repeats horizontally only
The background image is centered and does not repeat
If an image is stored in a folder named "assets" within the project directory, what is the correct way to reference it?
<img src="assets/image.jpg" alt="Sample">
<img src="/image.jpg" alt="Sample">
<img src="//assets/image.jpg" alt="Sample">
<img src="http://assets/image.jpg" alt="Sample">
Which of the following statements about the <img> tag is FALSE?
It does not have a closing tag
The src attribute is required
The width attribute is required
The alt attribute is used for accessibility.
What does background-attachment: fixed; do?
Prevents the background image from loading
Keeps the background image static while scrolling
Ensures the background image repeats across the entire page
Stretches the background image to fit the screen
What happens if an <img> tag does not have a src attribute?
The image is displayed with a placeholder
The browser automatically searches for a default image
The page does not load at all
A broken image icon appears
What is the correct way to link to a bookmark on a different page?
<a href="#bookmark">
<a href="page.html#bookmark">
<a href="bookmark.html#">
<a id="bookmark">
Which method should be used to ensure an image is responsive within a flexible layout?
width: 100%; height: auto;
width: auto; height: 100%;
width: fixed; height: auto;
width: 500px; height: 500px;
Which tag is used to create a bookmark within a webpage?
<bookmark>
<h2 id="section1">
<a href="#section1">
<div id="#section1">
Which CSS property is necessary to ensure a background image fills the entire viewport and does not scroll with the page?
background-size: contain;
background-size: cover; background-attachment: fixed;
background-repeat: no-repeat; background-align: center;
background-stretch: full;
Which of the following statements about using an image as a hyperlink is TRUE?
The <img> tag must have a title attribute to be clickable
The <img> tag must be wrapped inside an <a> tag to function as a link
The <img> tag automatically acts as a link if it has an alt attribute
The <img> tag cannot be used inside an <a> tag
Which attribute specifies the URL of the document that is embedded inside an iframe?
src
href
name
target
Which CSS property controls the border thickness, style, and color of an iframe?
border
border-width
outline
frame-style
Which attribute is used to make a table header span across multiple columns?
rowspan
span
colspan
coldwidth
Which of the following correctly applies a zebra stripe to table rows?
table:nth-child(even)
tr:nth-last-child(odd)
tr:alternate(even)
tr:nth-child(even)
Which property allows you to align multiple <div> elements side by side without using float?
display: inline;
position: relative;
justify-content: space-between;
display: inline-block;
Which of the following is NOT a correct way to set an image's dimensions?
<img src="image.jpg" width="300" height="200">
<img src="image.jpg" style="width: 300px; height: 200px;">
<img src="image.jpg" size="300x200">
<img src="image.jpg" alt="Image" width="50%">
What is the primary reason to use the alt attribute in an <img> tag?
To provide a caption for the image
To improve the image's resolution
To help the image for accessibility and in case of loading failure
To link the image to another webpage
How do you remove the default border around an iframe?
frameborder="0"
border="none"
style="border: none;"
border="0"
Which of the following is true about an HTML table header element <th>?
It always centers content regardless of CSS settings.
It can span multiple rows but not columns.
It uses bold and centered text by default.
It cannot be styled using CSS.
Which of the following correctly hides a table column using <colgroup>?
<col style="visibility: hidden;">
<col span=”3”>
<col style="visibility: collapse;">
<colgroup display="none">
<colgroup collapse="yes">
How do you create a borderless iframe in HTML?
Add border="0"
Use style="border-width: 0;"
Add style="border: none;"
iframe border-collapse: none;
What is the correct way to access all elements of a specific class using JavaScript?
document.getElementsByClassName("example");
document.getElementById("example");
document.querySelector(".example");
document.getElementsByTagName("example");
Which element is used to define a description list in HTML?
<list>
<dl>
<dt>
<dd>
Which CSS property can change the width between table cells?
padding
margin
width
border-spacing
What is the purpose of the <colgroup> element in an HTML table?
To define a group of rows.
To style or apply attributes to specific columns of a table.
To merge multiple cells into one.
To remove spacing between table cells.
Which HTML list element is used for an unordered list?
<ol>
<li>
<dl>
<ul>
How do you define a term in a description list?
<dt>
<dd>
<dl>
<li>
What is the correct way to change the starting number in an ordered list?
<ol num="3">
<ol begin="3">
<ol start="3">
<ol value="3">
Which CSS property should you use to create a grid layout with rows and columns in a <div>?
display: flex;
position: grid;
display: grid;
grid-template: auto;
When nesting HTML lists, which of the following is correct?
Nest an <ul> or <ol> directly inside an <li> element.
Place nested lists inside a <div> element for structure.
Use <li> to enclose both parent and child lists.
Add a nested <ul> or <ol> inside an <li> element.
What happens if you try to apply the same id to multiple elements in an HTML document?
The browser ignores the duplicate IDs and applies styles to the first one only.
All elements with the same id will get the specified styles, but JavaScript will only access the first one.
It triggers a JavaScript error, preventing the page from loading correctly.
It creates an invalid HTML document, which may cause unpredictable results.
What is the primary difference between using the class attribute and the id attribute in HTML?
id is case-insensitive, while class is case-sensitive.
class can be used only once, while id can be used multiple times.
Both class and id can be used interchangeably.
class can be applied to multiple elements, while id must be unique in a document.
