Programming for the web – A Level Information Technology (9626)

66 questions · page 5 of 5 · Clear filters

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
61
9626/32/F/M/18 · Question 6Feb/March 2018Paper 328 marks
Loading question…
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>

62
9626/32/O/N/17 · Question 11Oct/Nov 2017Paper 326 marks
Loading question…
Question text

11
A shop is open between 12 noon and 10 pm.
While the shop is closed in the morning, a message saying “Sorry, we are closed” is displayed.
After the shop has closed in the evening a message saying “Please try again tomorrow” is
displayed. At all other times, a message saying, “Hello, we are open now” is displayed.
JavaScript code can be used to alter web pages in real time.
Complete the code in the function below that will allow a user to find out if the shop is open or
closed.
function OpenTimesFunction() {
var welcome;
var timenow = new Date().getHours();
…
…
…
…
…
…
…
…
document.getElementById(“open”).innerHTML = welcome;
//This line displays the result of the code
}
[6]

63
9626/31/M/J/17 · Question 3May/June 2017Paper 316 marks
Loading question…
Question text

3
Frank is a web designer who writes his own code and uses JavaScript on his webpages. He
wants to print his name on every page. He creates two versions of the code to run his JavaScript
on the webpage. These versions are represented here:
Version 1:
<script language="JavaScript">
document.write ("<p>My name is <b>Frank </b> </p>");
</script>
Version 2:
<script language="JavaScript" src="FranksJavaScriptcode.js">
</script>
where the instructions for writing Frank’s name are in the file called “FranksJavaScriptcode.js”
Explain why Frank prefers to use Version 2 of the code.
…
…
…
…
…
…
…
…
…
…
…
…
…
… [6]

Advertisement
64
9626/32/M/J/17 · Question 6May/June 2017Paper 3210 marks
Loading question…
Question text

6
Quick Response (QR) codes are used in marketing to convey information to users.
(a) Describe how a QR code stores information.
…
…
…
…
…
…
…
…
…
… [4]
(b) Describe the benefits to advertisers of using QR codes on their products.
…
…
…
…
…
… [2]
(c) Describe how a QR code may put the user at risk from malicious code.
…
…
…
…
…
…
…
…
…
…

65
9626/32/M/J/17 · Question 9May/June 2017Paper 328 marks
Loading question…
Question text

9
JavaScript is a programming language used in webpages.
Fig. 2 shows a table created with JavaScript in a webpage.
1
2
3
4
5
6
7
8
9
10
2
4
6
8
10
12
14
16
18
20
3
6
9
12
15
18
21
24
27
30
4
8
12
16
20
24
28
32
36
40
5
10
15
20
25
30
35
40
45
50
6
12
18
24
30
36
42
48
54
60
7
14
21
28
35
42
49
56
63
70
8
16
24
32
40
48
56
64
72
80
9
18
27
36
45
54
63
72
81
90
10
20
30
40
50
60
70
80
90
100
Fig. 2
The code that created the table is shown below:
<html>
<body>
<script language="javascript">
var tableout;
tableout = "<table border='1' width='300' cellspacing='0'
cellpadding='3'>"
for (b = 1; b <= 10; b++) {
tableout = tableout + "<tr>";
for (g = 1; g <= 10; g++) {
tableout = tableout + "<td>" + b * g + "</td>";
}
tableout = tableout + "</tr>";
}
tableout = tableout + "</table>";
document.write (tableout);
</script>
</body>
</html>
Explain how the loops in the code create the table.
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…

66
9626/32/F/M/17 · Question 9Feb/March 2017Paper 3213 marks
Loading question…
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.
…
…
…
…
…
…

Advertisement