html exam style questions from past papers Flashcards
(15 cards)
HTML stands for Hypertext Markup Language. Explain what is meant by a
“markup” language.
[2 marks
A markup language uses special tags to define the structure and presentation of a document.
It tells the web browser how different parts of the content should be displayed.
Explain the difference between block-level elements and inline elements in
an HTML document, giving an example of each kind.
[4 marks]
(c) Write some HTML code to display a table with the follow
Block-level elements start on a new line and take up the full width of the page.
➡️ Example: <p>, <div>
Inline elements stay in the same line as the surrounding text and only take up as much space as needed.
➡️ Example: <a>, <img></img></a>
term “hypertext”.
[2 marks]
(b) Which two of the following elements are required to be present in any HTML
document?
[2 marks]
i. <meta></meta>
ii. <body>
iii. <head>
iv. <style></style>
<body>
<head>
</head></body>
HTML stands for Hypertext Markup Language. Explain what is meant by the
term “hypertext”.
“Hypertext is a term used to describe text that contains links (hyperlinks) to other documents, sections, or media. It allows users to navigate between different pieces of content
The following snippet of HTML code contains three errors. List the errors,
and describe how they can be corrected
<h1>Dinosaurs Are Cool
<p>
The dinosaurs are group of reptiles that first evolved
243 million years ago.
<br></br></br>
<a>
<!-- TODO: maybe change this image-->
<img></img>
</a href="t-rex-factsheet.html">
</p>
</a></p></h1>
the error is
(1) <h1> should have a closing tag
(2) <br></br> should not have a closing tag
(3) The href attribute is placed after the closing </a> tag, which is incorrect. The href attribute should be inside the opening <a> tag.</a>
Write some HTML code to display a table with the following contents.
* Three columns, with headings “Item”, “Quantity”, and “Price”.
* Two rows of data, showing 5 apples at £0.50 and 3 mangoes at £1.10.
* Acaption of “Healthy Shopping List”
<table>
<caption>Healthy Shopping List</caption>
<thead>
<tr>
<th>Item</th>
<th>Quantity</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>Apples</td>
<td>5</td>
<td>£0.50</td>
</tr>
<tr>
<td>Mangoes</td>
<td>3</td>
<td>£1.10</td>
</tr>
</tbody>
</table>
what is <tr> and <th> used for in tables
tr = actual data and th = heading
Consider the following element for defining a link in a web page.
<a>search</a>
Modify this element by adding an appropriate target attribute so that the
page opens in a new browser window or tab when the link is clicked. [2 marks
<a> href =”https: //www.google.com/” target=”_blank” >search</a>
what about <tr>
is used for rows
Give some HTML code to display a numbered list containing the following
items: (1) Tommy’s Kitchen (2) Kimiko (3) The Union Shop
ordered list is the same as a numbered list so the answer to this question would be
<ol>
<li> tommy kitchen</li>
<li> kimiko</li>
<li> the union shop</li>
</ol>
Consider the following XHTML code, which is invalid.
[3 marks]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html>
<head>
<title>Register for our shiny new service</title>
<body>
<h1>Sign Up!</h1>
<!-- Need to give some more instructions-->
<p>Enter your name & click the button.
<input></input>
</p>
<br></br><input></input>
</body>
</html>
i. List the three errors that mean the above code is not valid XHTML, and
state how they can be fixed.
</head></html>
Missing Closing <head> Tag
Error: The <head> section is opened but never closed before the <body> starts.
Fix: Add </head> before <body> to properly close the <head> section.
Improperly Capitalized <P> Tag
Error: XHTML requires all tags to be in lowercase, but <P> is capitalized.
Fix: Change <P> to <p> to adhere to XHTML standards.
Unnecessary <br></br> Before Button
Error: The <br></br> tag isn’t necessary and isn’t the best approach for structuring elements in XHTML.
Fix: Remove <br></br> and place the button inside a suitable block element, such as <p>.
. What is a markup language used for?
ii. Name two different markup languages (3marks)
A markup language is used to define the structure, organization, and presentation of content in documents, particularly on the web. It uses tags or elements to indicate how content should be organized and displayed. For example, HTML (Hypertext Markup Language) structures web pages by defining elements like headings, paragraphs, and lists. Markup languages also describe the meaning of content, such as identifying a section of text as a heading or a link, which helps browsers display content correctly. Additionally, they are used in combination with other technologies like CSS for styling and JavaScript for functionality.
Name two different markup languages
html and XML
Name the four elements that must be included in any HTML document.
The four elements that must be included in any HTML document are:
<!DOCTYPE html> - Declares the document type and version of HTML being used (e.g., HTML5).
<html> - The root element that wraps all the content of the HTML document.
<head> - Contains meta-information about the document, such as the title, character set, and links to stylesheets or scripts.
<body> - Contains the visible content of the webpage, such as text, images, and other HTML elements.
</body></head></html>