0% found this document useful (0 votes)
32 views

CS Questions by Topic 3

The document describes a client-server model of networked computers. It discusses the benefits of using this model and provides a diagram of a computer network connected to the Internet. The diagram shows a file server and mail server connected to client computers. The document also provides a description of the sequence of steps when a user requests a web page that contains HTML and JavaScript code. It discusses client-side scripting and provides an example of a web page that uses JavaScript to perform validation on user-entered data before submitting an order.

Uploaded by

Ahmed Wael
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

CS Questions by Topic 3

The document describes a client-server model of networked computers. It discusses the benefits of using this model and provides a diagram of a computer network connected to the Internet. The diagram shows a file server and mail server connected to client computers. The document also provides a description of the sequence of steps when a user requests a web page that contains HTML and JavaScript code. It discusses client-side scripting and provides an example of a web page that uses JavaScript to perform validation on user-entered data before submitting an order.

Uploaded by

Ahmed Wael
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

QUESTION 3.

7 (a) (i) Describe what is meant by a client-server model of networked computers.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[2]

(ii) Give two benefits of using the client-server model.

1 ........................................................................................................................................

...........................................................................................................................................

2 ........................................................................................................................................

...........................................................................................................................................
[2]

(b) The diagram shows a computer network with connection to the Internet.

client computer client computer


Internet

file server

mail server

Name the hardware device labelled X.

...............................................................................................................................................[1]

© UCLES 2015 9608/11/O/N/15


9

(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 requested web page is displayed on the client computer

The user clicks on the hyperlink and the web page is requested
from the web server

The requested web page content is transmitted to the client


computer

The client computer processes the JavaScript code using the


web browser software

The web server locates the requested web page

[5]

© UCLES 2015 9608/11/O/N/15 [Turn over


QUESTION 4. 13

7 The design of a web-based application can require the use of client-side scripting.

(a) Describe what is meant by 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.

The requested page contains a client-side script.

Describe the sequence of steps leading to the display of the web page on the computer
screen.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...............................................................................................................................................[4]

© UCLES 2017 9608/11/M/J/17 [Turn over


14

(c) A web page used for data capture consists of:

• two text boxes for the entry of:


• a product code
• the number of items to be purchased.
• a button which is clicked when the user wants to submit this order.

Study the following web page.

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>

© UCLES 2017 9608/11/M/J/17


15

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

State the line numbers that contain this code.

From line .............................. to line .............................. [1]

(iii) The JavaScript code uses a selection statement.

State the line number that contains the condition.

Line number: ................................................................. [1]

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

Validation check: ...............................................................................................................

Description ........................................................................................................................

...........................................................................................................................................

Validation check: ...............................................................................................................

Description ........................................................................................................................

...........................................................................................................................................
[4]

© UCLES 2017 9608/11/M/J/17


QUESTION 5. 10

6 Downloading a file from a website is an example of a client-server application.

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

© UCLES 2017 9608/12/M/J/17


11

Question 6(c) begins on the next page.

© UCLES 2017 9608/12/M/J/17 [Turn over


12

(c) The following web page used for data capture consists of:

• two text boxes for the entry of:


° a race runner’s ID code
° their finishing position in a race.
• a button that the user clicks to submit this runner’s result.

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>

© UCLES 2017 9608/12/M/J/17


13

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

State the line numbers which contain this code.

From line .................................... to line .................................... [1]

(iii) The JavaScript code uses a selection statement.

State the line number which contains its condition.

Line number: .................................... [1]

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

Validation check: ...............................................................................................................

Description ........................................................................................................................

...........................................................................................................................................

Validation check: ...............................................................................................................

Description ........................................................................................................................

...........................................................................................................................................
[4]

© UCLES 2017 9608/12/M/J/17


14

BLANK PAGE

© UCLES 2017 9608/12/M/J/17


15

BLANK PAGE

© UCLES 2017 9608/12/M/J/17


QUESTION 6. 3

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.

Context Item of translation software

A web page contains a client-side script.

Assembler

Each instruction in the source code


consists of an op code and an operand.

Interpreter

The source code is required at run-time.

Compiler

When the source code is translated,


copies of the executable program can be
distributed without the need for the source
code.
[4]

(b) The Java programming language is said to be machine or platform independent.

(i) Describe what is meant by machine independent.

...........................................................................................................................................

.......................................................................................................................................[1]

(ii) Describe how a Java source code program is translated.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[2]

© UCLES 2017 9608/11/O/N/17 [Turn over


QUESTION 7. 3

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.

Context Item of translation software

The source code is written in a high-level


language. An executable file is produced.

Assembler

The source code uses instructions from


the processor’s instruction set.

Interpreter

The source code and translation


software must both be in main memory at
execution time.

Compiler

A web page contains some JavaScript


code.

[4]

(b) A programmer is developing software and has both a compiler and interpreter for the
high-level language used.

Describe two benefits of using each form of translation software.

(i) Benefits of a compiler

1 ........................................................................................................................................

...........................................................................................................................................

2 ........................................................................................................................................

...........................................................................................................................................
[2]
(ii) Benefits of an interpreter

1 ........................................................................................................................................

...........................................................................................................................................

2 ........................................................................................................................................

...........................................................................................................................................
[2]

© UCLES 2017 9608/12/O/N/17 [Turn over


QUESTION 8. 11

6 A web page includes the following PHP and HTML code.

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

(a) Name two identifiers used in the PHP code.

1 ................................................................................................................................................

2 ................................................................................................................................................
[2]

(b) Write the value assigned to $message if the user types 30 in the text box.

...............................................................................................................................................[1]

(c) Explain the purpose of the code in line 18.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...............................................................................................................................................[2]

© UCLES 2018 9608/11/O/N/18 [Turn over


12

(d) The PHP code in a web page uses server-side scripting.

List the sequence of events that take place when a user requests a web page containing PHP
code.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...............................................................................................................................................[4]

© UCLES 2018 9608/11/O/N/18


13

Question 7 begins on the next page.

© UCLES 2018 9608/11/O/N/18 [Turn over


QUESTION 9. 9

4 Customers of a bank can access their account information by logging in on the bank’s website.

(a) The bank has a client-server model of networked computers.

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

Explain why the web application uses server-side scripting.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

© UCLES 2019 9608/11/O/N/19 [Turn over


10

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

(ii) State two drawbacks of upgrading to fibre-optic cables.

1 ........................................................................................................................................

...........................................................................................................................................

2 ........................................................................................................................................

...........................................................................................................................................
[2]

© UCLES 2019 9608/11/O/N/19


11

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

A customer can have more than one account.

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

Table name ........................................................................................................................

Foreign key .......................................................................................................................


[1]
© UCLES 2019 9608/11/O/N/19 [Turn over
12

(iv) The following table has definitions of database terms.

Write the correct database term in the table for each definition.

Definition Term

All the data about one entity

The data in one row of a table

A column or field in a table


[3]

© UCLES 2019 9608/11/O/N/19


QUESTION 10. 4

3 A web page includes the following JavaScript and HTML code.

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>

(a) Name two identifiers used in the JavaScript code.

1 ................................................................................................................................................

2 ................................................................................................................................................
[2]

(b) The number 9 is typed into textBox1.

Write the value that is output after button1 is pressed.

............................................................................................................................................. [1]

(c) State the purpose of the code in line 14.

...................................................................................................................................................

............................................................................................................................................. [1]

© UCLES 2019 9608/12/O/N/19


5

(d) Line 20 is replaced with:

20 alert(value1 + value1);

Describe how this will affect the program.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2019 9608/12/O/N/19 [Turn over


QUESTION 11. 12

6 Willow is creating a website.

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>

(a) (i) Name three functions in the JavaScript code.

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]

© UCLES 2019 9608/13/O/N/19


13

(iv) Describe the purpose of the code on line 16.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

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

© UCLES 2019 9608/13/O/N/19 [Turn over

You might also like