Date | May 2019 | Marks available | 3 | Reference code | 19M.2.SL.TZ0.7 |
Level | SL | Paper | 2 | Time zone | no time zone |
Command term | Explain | Question number | 7 | Adapted from | N/A |
Question
Sestra.com is a website maintained by a company who sell items made by local craftspeople.
The website is compatible with different screen sizes and formats ranging from desktop computers to mobile smartphones. All the site’s pages contain the following code fragment:
<link rel = "stylesheet" href = "../css/default.css">
Visitors to the site can search categories of products (for example “Toys”, “Bags”, “Dresses” etc.) selected from a drop-down menu. The menu is populated from the records stored in the CATEGORY
table of the site’s database.
Parts of the code of the file search.php
is shown below:
// Other code present here
<?php
$categoryquerytext = 'SELECT 'category_id', 'category_name' FROM
'CATEGORY' ORDER BY 'category_name'';
$categoryqueryresult = mysqli_query($con, $categoryquerytext);
?>
// Other code present here
<form action = "showresults.php" method = "post">
<select name = "category">
<?php
while($row = mysqli_fetch_array($categoryqueryresult))
{
echo '<option value = "'. $row['category_id']. '">'.
$row['category_name']. '</option>';
}
?>
</select>
<button type = "submit">Search</button>
</form>
// Other code present here
The owners of the company have noticed that Sestra.com does not appear very prominently in search engine results.
The Sestra.com site includes:
- images of each product
- pdf documents giving background information about the craftspeople who produced the products.
Identify two ways that a cascading style sheet (CSS) can be used to ensure web pages are compatible with different screen sizes and formats.
Explain the processing this code enables on the server before search.php
is sent to the client.
Describe two ways in which the site developers could use white hat optimization to improve the site’s search engine ranking.
Distinguish between lossy and lossless compression.
Explain why the developers at Sestra.com would use lossless compression for the pdf documents.
Markscheme
Award [2 max].
Change/re-flow the layout of the page to suit different screen sizes/formats;
adjust font sizes;
adjust image sizes;
provide alternative menus / link options;
Award [3 max].
The code:
- uses SQL to query the
CATEGORY
table in a database, selecting all pairs of<category_id, category_name>
ordered by category_name; - stores the results of the query in a variable / array
$categoryqueryresult
; - prepares HTML for a drop-down menu which consists of a list of option tags derived from iterating through each pair in $categoryqueryresult;
- sets the
“value”
attribute of each menu item tocategory_id
; - sets the
“text”
attribute of each menu item tocategory_name
.
Award [4 max].
Mark as [2] and [2].
Include authoritative / high quality website content;
To attract other reputable sites to link to it / promote it in the search engine ranking;
Use appropriate use meta tags (e.g. keywords/descriptions);
To provide clear data for web-crawlers/robots to use when categorising the page;
Separate content from formatting (e.g. use of CSS etc.);
To allow search engines to index the content of the site more effectively;
Use site maps / site diagrams;
To aid indexing by web-crawlers/robots;
Include a robots.txt file in the page header;
To give instructions to web-crawlers/robots as to how to index and describe the various pages on the site;
Award [2 max].
Lossy compression
Reduces the file-size by removing some of the data in the file;
Once removed, the data cannot be recovered;
This generally results in a loss of quality (e.g. picture resolution, audio frequency range);
Files compressed using lossy compression are used in their compressed form (e.g. images, video, audio);
Lossless compression
Reduces file size by looking for repeated patterns of data / redundant data and replacing those with a single shorter "token";
The tokens are associated with the data they represent by using a dictionary added to the file;
Flies must be decompressed before they can be used;
Decompression software reads the dictionary and replaces all the tokens with the original data They represent;
Files do not lose any of the data they contain when compressed / decompressed;
Award [3 max].
Lossless compression reduces file size while preserving all the data;
Once decompressed, the pdf document will contain all the data in the original document;
Some pdf software allows for the automatic lossless compression of the document / the developers would not have to apply compression retrospectively;
It would be hard for a lossy compression algorithm to distinguish between data that can be removed (e.g. reducing the resolution of the images) and data that is necessary for the pdf documents to make sense (e.g. parts of the text);
Using lossy compression may result in an unusable/unreadable document;
Accept answers that focus on why lossy compression would be unsuitable for the pdf files.
Examiners report
Many candidates reasonably answered this question. However, some candidates were unable to demonstrate the understanding of how style sheets could be coded differently to tackle different screen sizes.
The vast majority of students didn’t write the expected response. Most of the responses were superficial and generic in nature.
The question was answered correctly by most of the candidates.
The question was reasonably answered by majority of the candidates.
The question was reasonably answered by majority of the candidates. However, some responses lacked the details.