html exam style questions from past papers Flashcards

(15 cards)

1
Q

HTML stands for Hypertext Markup Language. Explain what is meant by a
“markup” language.
[2 marks

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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

A

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>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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>

A

<body>
<head>
</head></body>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

HTML stands for Hypertext Markup Language. Explain what is meant by the
term “hypertext”.

A

“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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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>

A

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>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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”

A

<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>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is <tr> and <th> used for in tables

A

tr = actual data and th = heading

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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

<a> href =”https: //www.google.com/” target=”_blank” >search</a>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what about <tr>

A

is used for rows

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Give some HTML code to display a numbered list containing the following
items: (1) Tommy’s Kitchen (2) Kimiko (3) The Union Shop

A

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>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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 &amp; 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>

A

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>.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

. What is a markup language used for?
ii. Name two different markup languages (3marks)

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Name two different markup languages

A

html and XML

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Name the four elements that must be included in any HTML document.

A

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>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly