CS Questions by Topic 3
CS Questions by Topic 3
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
[2]
(b) The diagram shows a computer network with connection to the Internet.
file server
mail server
...............................................................................................................................................[1]
(c) A web page offers a link for users to request another web page. The requested web page
contains HTML code and JavaScript code.
Put each statement in the correct sequence by writing the numbers 1 to 5 in the right-hand
column.
Sequence
Statement
number
The user clicks on the hyperlink and the web page is requested
from the web server
[5]
7 The design of a web-based application can require the use of client-side scripting.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
(b) A user requests a web page by keying the Uniform Resource Locator (URL) into the address
bar of their web browser.
Describe the sequence of steps leading to the display of the web page on the computer
screen.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[4]
1 <html>
2 <head>
3 <title>Untitled Document</title>
4 <script language="JavaScript">
5
6 function myButton_onmousedown()
7 {
8 var Message1 = "ERROR – Order refused";
9 var Message2 = "Product code OK";
10 var x = document.forms["form1"]["txtProductCode"].value;
11 if (x == "")
12 {
13 alert(Message1)
14 }
15 else
16 {
17 alert(Message2)
18 }
19 }
20 </script>
21
22 </head>
23 <body>
24 <form name = form1>
25 <label>Product code: </label>
26 <input type="text" name="txtProductCode" >
27 <label>Number: </label>
28 <input type="text" name="txtNumber" size = "5" >
29 <p>
30 <label>Submit order: </label>
31 <input type="button" name="btnSubmit" Value = "Submit"
32
33 onMouseDown = "myButton_onmousedown()" >
34 </p>
35 </form>
36
37 </body>
38 </html>
(i) The developer has used three variables in the JavaScript code. State the identifiers used.
1 ..................................................................
2 ..................................................................
3 .................................................................. [2]
(ii) The button has an event whose identifier is onMouseDown. When the submit button is
clicked, some code is executed.
(iv) Describe the purpose of the validation check that the code performs.
...........................................................................................................................................
.......................................................................................................................................[1]
(v) Name and describe two other types of validation check that could be appropriate for this
data capture form.
Description ........................................................................................................................
...........................................................................................................................................
Description ........................................................................................................................
...........................................................................................................................................
[4]
(a) Describe what is meant by the term client-server for this application.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
(b) The following sequence of steps (1 to 5) describes what happens when someone uses their
personal computer (PC) to request a web page. The web page consists of HTML tags and
text content only. Four of the statements from A, B, C, D, E and F are used to complete the
sequence.
A Browser software interprets the script, renders the page and displays.
B Browser software renders the page and displays.
C Browser software compiles the script, renders the page and displays.
D The web server retrieves the page.
E The Domain Name Service (DNS) uses the domain name from the
browser to look up the IP address of the web server.
F The web server sends the web page content to the browser.
Write one of the letters A to F in the appropriate row to complete the sequence.
1. The user keys in the Uniform Resource Locator (URL) into the browser software.
2. ....................................
3. ....................................
4. ....................................
5. ....................................
[4]
(c) The following web page used for data capture consists of:
1 <html>
2 <head>
3 <title>Untitled Document</title>
4 <script language="JavaScript">
5
6 function myButton_onmousedown()
7 {
8 var Output1 = "Runner ID OK";
9 var Output2 = "ERROR – entry refused";
10
11 var Runner ID = document.forms["form1"]["txtRunnerID"].value;
12 // || in Javascript is the 'OR' operator
13 if (RunnerID.substr(0,3) == "VAR" || RunnerID.substr(0,3) == "CAM")
14 {
15 alert(Output1)
16 }
17 else
18 {
19 alert(Output2)
20 }
21 }
22 </script>
23
24 </head>
25 <body>
26 <form name = form1>
27 <label>Runner ID: </label>
28 <input type="text" name="txtRunnerID" >
29 <label>Position: </label>
30 <input type="text" name="txtPosition" size = "5" >
31 <p>
32 <label>Save data: </label>
33 <input type="button" name="btnSubmit" Value = "Submit"
34
35 onMouseDown = "myButton_onmousedown()" >
36 </p>
37 </form>
38
39 </body>
40 </html>
(i) The developer has used three variables in the JavaScript code. State the identifiers
used.
1. ....................................
2. ....................................
3. .................................... [2]
(ii) The button has an event whose identifier is onMouseDown. When the mouse button is
clicked, some code is run.
(iv) Describe the purpose of the validation check that the code performs.
...........................................................................................................................................
.......................................................................................................................................[1]
(v) Name and describe two other types of validation check which could be appropriate for
this data capture form.
Description ........................................................................................................................
...........................................................................................................................................
Description ........................................................................................................................
...........................................................................................................................................
[4]
BLANK PAGE
BLANK PAGE
2 (a) The diagram shows three items of software that translate program code.
Draw one line from each context to the correct item of translation software.
Assembler
Interpreter
Compiler
...........................................................................................................................................
.......................................................................................................................................[1]
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
2 (a) The diagram shows three items of software that translate program code.
Draw one line from each context to the correct item of translation software.
Assembler
Interpreter
Compiler
[4]
(b) A programmer is developing software and has both a compiler and interpreter for the
high-level language used.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
[2]
(ii) Benefits of an interpreter
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
[2]
01 <?php
02 if(isset($_GET['age'])) {
03 echo "Result: ", allowed($_GET['age']);
04 } else {
05 ?>
06
07 <form action="#" method="get">
08 Enter Age: <input type="text" name="age" /><br/>
09 <input type="submit" value="Calculate" />
10 </form>
11
12 <?php
13 }
14 function allowed($age) {
15 if($age <= 16) $message = "You need permission";
16 else if($age > 30) $message = "You are too old";
17 else $message = "Allowed";
18 return $message;
19 }
20 ?>
1 ................................................................................................................................................
2 ................................................................................................................................................
[2]
(b) Write the value assigned to $message if the user types 30 in the text box.
...............................................................................................................................................[1]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
List the sequence of events that take place when a user requests a web page containing PHP
code.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[4]
4 Customers of a bank can access their account information by logging in on the bank’s website.
(i) Describe, using the bank as an example, the key features of a client-server model.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [3]
(ii) Give two other examples of applications that can use the client-server model.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
[2]
(b) The bank’s customers log in to the website using a web application.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
(c) The bank is upgrading its local area network (LAN) copper cables to fibre-optic cables.
(i) State two benefits to the bank of upgrading to fibre-optic cable from copper cable.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
[2]
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
[2]
(d) The bank uses a relational database, ACCOUNTS, to store the information about customers
and their accounts.
The database stores the customer’s first name, last name and date of birth.
The bank has several different types of account. Each account type has a unique ID number,
name (for example, regular or saving) and bonus (for example, $5.00, $10.00 or $15.00).
Each customer’s account has its own ID number and stores the amount of money the
customer has in that account.
The bank creates a normalised, relational database to store the required information. There
are three tables:
• CUSTOMER
• ACCOUNT_TYPE
• CUSTOMER_ACCOUNT
(i) Write the attributes for each table to complete the database design for the bank.
CUSTOMER( .......................................................................................................................
...........................................................................................................................................
.........................................................................................................................................)
ACCOUNT_TYPE( ..............................................................................................................
...........................................................................................................................................
.........................................................................................................................................)
CUSTOMER_ACCOUNT( ......................................................................................................
...........................................................................................................................................
.........................................................................................................................................)
[3]
(ii) Identify the primary key for each table that you designed in part (d)(i).
CUSTOMER .........................................................................................................................
ACCOUNT_TYPE ................................................................................................................
CUSTOMER_ACCOUNT ........................................................................................................
[2]
(iii) Identify one foreign key in one of the tables that you designed in part (d)(i).
Write the correct database term in the table for each definition.
Definition Term
01 <html>
02 <body>
03
04 <form>
05 <p><input type="text" id="textBox1"></p>
06 <button id = "button1" onclick="multiply()">First</button>
07 <button id = "button2" onclick="addition()">Second</button>
08 </form>
09
10 </body>
11 <script>
12 function multiply(){
13 value1 = document.getElementById("textBox1").value;
14 value1++;
15 alert(parseInt(value1)* parseInt(value1));
16 }
17
18 function addition(){
19 value1 = document.getElementById("textBox1").value;
20 alert(parseInt(value1) + parseInt(value1));
21 }
22 </script>
23 </html>
1 ................................................................................................................................................
2 ................................................................................................................................................
[2]
............................................................................................................................................. [1]
...................................................................................................................................................
............................................................................................................................................. [1]
20 alert(value1 + value1);
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
One of the web pages includes the following JavaScript code and HTML tags.
01 <html>
02 <body>
03 <form>
04 <p id="displayQuestion"></p>
05 <input type="text" id="answer">
06 <button id="submit" onclick="checkAnswer()"> Submit </button>
07 </form>
08 </body>
09 <script>
10 val1 = Math.floor((Math.random() * 10) + 1);
11 val2 = Math.floor((Math.random() * 10) + 1);
12 document.getElementById("displayQuestion").innerHTML = "What is" +
val1.toString() + "*" + val2.toString() + "?";
13 function checkAnswer(){
14 userAnswer = document.getElementById("answer").value;
15 answer = val1 * val2
16 if (userAnswer == answer.toString()){
17 alert("Correct, well done");
18 }else{
19 alert("Sorry that's incorrect");
20 }
21 }
22 </script>
23 </html>
1 ........................................................................................................................................
2 ........................................................................................................................................
3 ........................................................................................................................................
[3]
(ii) Identify every line number of the JavaScript code that generates an output.
...........................................................................................................................................
..................................................................................................................................... [2]
(iii) Identify the line number of the JavaScript code that takes data the user has input and
stores it in a variable.
..................................................................................................................................... [1]
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [2]
(b) Willow used functions from a JavaScript program library in the web page.
Describe the benefits to Willow of using program libraries to create the web page.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [4]