Programming for the web – A Level Information Technology (9626)
14 questions · Clear filters
Question text
1
The visibility of HTML elements in a webpage can be controlled by JavaScript statements that
change the style property.
The statement below sets the style property of an element to a default value.
document.getElementById(id).style.visibility = "initial"
Describe how this statement is used in JavaScript to alter the appearance of HTML elements.
…
…
…
…
…
…
…
…
…
…
…
…
…
… [6]
© Cambridge University Press & Assessment 2026
Question text
2
The content of web pages is displayed in a web browser. The web browser obtains the content
from a web server.
Describe, in detail, how the request and response method of communication between a web
browser and a web server functions.
…
…
…
…
…
…
…
…
…
…
…
…
…
… [6]
© Cambridge University Press & Assessment 2026
Question text
1
Programmers can use JavaScript to make a web page react when an HTML event occurs.
(a) Describe what is meant by an HTML event.
…
…
…
…
…
… [2]
(b) Describe the action that causes each of the following HTML events to start.
(i)
onmouseover()
…
…
… [1]
(ii)
onmouseout()
…
…
… [1]
(iii)
onload()
…
…
… [1]
ĬÕú¾Ġ´íÈõÏĪÅĊÞú¸þ×
Question text
2
Explain why break statements, functions and comments are used in JavaScript code.
(a) Break statements
…
…
…
…
…
… [2]
(b) Functions
…
…
…
…
…
… [2]
(c) Comments
…
…
…
…
…
… [2]
Question text
8
JavaScript code can be written to perform different actions depending on different conditions.
(a) Describe the use of the switch operator, such as switch(name), in JavaScript code to select
different actions.
…
…
…
…
…
…
…
…
…
… [4]
(b) Describe the use of logical operators in conditional statements in JavaScript code.
…
…
…
…
…
…
…
…
…
…
…
…
…
… [6]
Question text
7
The prompt() method is used in JavaScript to provide a popup dialog box for users to interact
with web pages.
(a) Explain how the result of the user interaction from prompt() is used by a programmer to
collect the input from a user.
…
…
…
…
…
…
…
…
…
…
… [4]
(b) Explain two limitations of using the prompt() method of user interaction.
1 …
…
…
2 …
…
…
[2]
Question text
3
QR codes are two-dimensional barcodes (matrix barcodes) which store information. The codes
can be used to contain links to a website.
(a) Describe three other uses of information that can be contained in QR codes.
…
…
…
…
…
…
… [3]
(b) QR codes can often be found on products in supermarkets.
Evaluate, by weighing up the advantages and disadvantages, the use of QR codes for holding
information about the products.
…
…
…
…
…
…
…
…
…
…
…
…
…
… [6]
Question text
3
(a) Describe the characteristics of incremental prototyping.
…
…
…
…
…
…
…
…
…
… [4]
(b) Discuss the advantages and disadvantages of incremental prototyping.
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
...
Question text
4
Describe how 3D printing would be used when creating objects for use in space exploration.
…
…
…
…
…
…
…
…
…
…
…
…
…
… [6]
Question text
9
In JavaScript, conditional statements can be used to carry out specific actions based upon different
conditions. The value of the variable ‘age’ is entered into a web page and collected by the HTML
code of the page. The function in Fig. 9.1 uses the ‘if else’ and ‘else if’ conditional statements
to test the value of the variable ‘age’. Line numbers are shown only for your convenience when
referring to the code.
1
function myFunction() {
2
var statement;
3
var age = document.getElementById("age").value;
4
if (age < 10) {
5
statement = "You are not old enough to go to this school";
6
} else if (age < 18) {
7
statement = "You can go to this school";
8
} else {
9
statement = "You are too old to go to this school";
10
}
Fig. 9.1
(a) Explain, with reference to the code in the function, how the ‘if else’ and ‘else if’ statements
operate to provide the appropriate statement when an age is entered into the web page and
collected by the HTML code.
…
…
…
…
…
…
…
…
…
…
…
…
…
… [6]
(b) The code could have been written using the ‘switch’ function, e.g. lines 4 to 7 could have
been:
4
switch(true) {
5
case age < 10:
6
statement = "You are not old enough to go to this school";
7
break;
with additional lines for the other conditions.
Explain the drawbacks of using the ‘switch’ function.
…
…
…
…
Question text
1
Errors in JavaScript code can cause the code to fail to execute when run by a web browser. The
code shown is intended to display a table on a web page when run in a web browser.
The line numbers are shown only for your convenience when referencing the code in your
answers.
1
<html>
2
<body>
3
<script language="JavaScript">
4
tableout = "<table border='1' width='300' cellspacing='0'
cellpadding='3'>"
5
for (b = 1; b <= 10; b++) {
6
tableout = tableout + "<tr>":
7
for (g = 1; g <= 10; g++) {
8
tableout = tableout + "<td>" + b * g + "</td>";
9
}
10
tableout = tableout + "</tr>";
11
}
12
tableout = tableout + "</table>";
13
document.write (tableout);
14
</script>
15
</body>
16
</html>
(a) The code does not run as intended in web browsers because there is an error in the code.
Describe how the error in the code prevents the web browser from running as intended.
…
…
…
…
…
… [2]
(b) Errors can be ‘trapped’ in order that the performance of the web browser is not affected.
Explain how you can use error handling techniques to trap errors in JavaScript code.
…
…
…
…
…
…
…
…
…
…
…
… [5]
Question text
8
The owners of a bank are replacing its current system by transferring all accounts and processes
to a new computer system. They have to be sure that the new system will carry out all the functions
of the old system.
It is essential that there is no interruption in the services provided by the bank’s computer system
to its staff and customers.
Choose the most appropriate method of implementation and explain how the new system will be
implemented.
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
… [8]
Question text
6
Drivers who are 16 years of age or older can apply for a driving licence online.
The government web page code requires applicants to enter their age and then checks if they are
old enough to apply.
The following code captures the applicant’s age. When the applicant clicks the ‘Check now’ button
the age is first checked to ensure that it is numeric. The age is then checked to see if the applicant
is old enough. Suitable messages are displayed as a result of the checks.
Complete the code for the function CheckAgeFunction that checks the age entered by the
applicant and displays an appropriate response.
<html>
<body>
<p>You can apply for a licence to drive when you are 16 years old.</p>
<p>To check if you are old enough to drive, input your age and click
the button:</p>
<input id="AgeNow" value="16" />
<button onclick="CheckAgeFunction()">Check now</button>
<p id="AgeCheck"></p>
<script>
function CheckAgeFunction() {
…
…
…
…
…
…
…
…
…
…
…
… [8]
}
document.getElementById("AgeCheck").innerHTML = CanApply;
}
</script>
</body></html>
Question text
9
JavaScript can be embedded in the code of web pages to add interactivity to a page.
Jonas uses JavaScript code to store, list and display the names of cities on a web page.
(a) Two methods of storing the names are shown below.
Method 1:
var
city1
=
"London";
var
city2
=
"Cambridge";
var
city3
=
"Oxford";
var
city4
=
"Manchester";
Method 2:
var city = ["London", "Cambridge", "Oxford", "Manchester"];
Explain why storing the names using Method 2 is more suitable for storing large numbers of
cities.
…
…
…
…
…
…
…
…
…
… [4]
(b) Jonas has added some lines to the JavaScript code:
/*
The code below stores the list of cities.
*/
var city = ["London", "Cambridge", "Oxford", "Manchester"];
Explain why Jonas would have added the new code to the script.
…
…
…
…
… [2]
(c) Jonas wants to extract ‘Oxford’ from the list in the code below to display it on the web page.
var city = ["London", "Cambridge", "Oxford", "Manchester"];
Write a line of JavaScript code to access the list and store the city name.
…
…
…
…
…
…