You are on page 1of 9

1

SECOND SEMESTER EXAMINATION - JULY 2020

COMPUTER SCIENCE

PAPER II

9 (Cambridge) ..........

Duration : 1 hour and 45 minutes

Instructions to Candidates : Answer all the questions.

Do not use calculators.

Candidate's name : ............................................................... Admission no : ...................


Grade 9 Cambridge Computer Science II July 2020 Page 1
2

1. (a) Identify two loop structures that you can use when writing pseudocode and provide a
description for each.
Loop structure 1
----------------------------------------------------------------------------------------------------
(1 mark)
Description
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
(2 marks)
Loop structure 2

----------------------------------------------------------------------------------------------------

(1 mark)
Description

----------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------

(2 marks)
[Total = 6 marks]

2. The temperatures in a greenhouse are being monitored. Temperatures between 20 degrees


Celsius – 30 degrees Celsius are considered good for the plants. If the temperature rises above 30
degrees Celsius, an alarm is triggered and the windows are automatically opened to allow the
moisture to leave the greenhouse.

(i) What validation checks should be used for the maximum temperature given and the
temperatures good for the plants?
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
(2 marks)

Grade 9 Cambridge Computer Science II July 2020 Page 2


3

(ii) Identify two constants in the above situation.


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
(2 marks)
(iii) Provide a set of normal data and their expected results.
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
(2 marks)
(iv) Provide a set of abnormal/erroneous data and their expected results.
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
(1 mark)
(v) Identify the boundary data required and their expected results.
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
(1 mark)
[Total = 8marks]
3. (a) For each of the four statements in the table, place a tick in the correct column to show whether
it is an example of validation or verification.

Statements Validation Verification


To automatically check the accuracy of a bar code
To check if the data input is sensible
To check if the data input matches the data that
has been supplied
To automatically check that all required data fields
have been completed

[Total = 4 marks]

Grade 9 Cambridge Computer Science II July 2020 Page 3


4

4. During the festival season, at a supermarket, the first 100 customers receive a 20% discount from
their total bill. The following program code is to calculate and output the final amount that each
customer has to pay after the discount.

1 final amount 0

2 FOR count 0 TO 100

3 INPUT tot_bill

4 final amount tot_bill-(tot_bill*0.2)

5 count count + 1

6 NEXT count

7 OUTPUT final_amount

There are three errors in this code.

Locate these errors and suggest a corrected piece of code for each error.

Error 1 : ---------------------------------------------------------------------------------

Correction : ---------------------------------------------------------------------------------

Error 2 : ---------------------------------------------------------------------------------

Correction : ---------------------------------------------------------------------------------

Error 3 : ---------------------------------------------------------------------------------

Correction : ---------------------------------------------------------------------------------

[Total = 6 marks]

5. Write an algorithm for the following case study using pseudocode or flowchart only.

A CD is being used to store 8 music files. Each minute worth of recording takes 12 megabytes.

• Input length of each track in minutes.

• Calculate and output how much memory occupies each track.

• Output the maximum and minimum memory size of the 8 tracks.

(NOTE: memory = recording speed (megabytes/minutes) x track length (minutes)

-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------

Grade 9 Cambridge Computer Science II July 2020 Page 4


5

-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
[Total = 6 marks]
6. A single - table database PATIENT is set up to store each patient’s name, ward number, gender
and age. Part of the database is shown below.

(i) How many records are there in the table ? --------------------------- (1 mark)

(ii) How many fields are there in the table ? ----------------------------- (1 mark)

Grade 9 Cambridge Computer Science II July 2020 Page 5


6

(iii) Show the results of the following query-by-example grid.

Field :

Table :

Sort :

Show :

Criteria :

Or :

---------------------------------------------------------------------------------------------------------

(2 marks)

(iv) Draw a query - by - example grid to show all the names of the patients in an ascending
order, whose age is below 16 or gender is female.

Field :

Table :

Sort :

Criteria :

Or :

(3 marks)

[Total = 7 marks]

Grade 9 Cambridge Computer Science II July 2020 Page 6


7

7. A mini cinema theatre offers children below the age of 18 a 50% discount on their tickets.
The tickets are priced at $40.00 for an adult and $20.00 for a child.
The below flow chart calculates the total cost for 10 people including adults and children for a
movie in the mini cinema theatre.

Start

count 1
totcost 0
ticketcost 0

INPUT age

Yes
Is age < 18? ticketcost 20

ticketcost 40

totcost totcost + ticketcost

count count + 1

Is
Yes No
count < = 10 ? OUTPUT totcost

END

Grade 9 Cambridge Computer Science II July 2020 Page 7


8

Trace the below table with the following test data.

24 , 36 , 12 , 18 , 9 , 18 , 14 , 35 , 18 , 10

count age ticketcost totcost output

[Total = 5 marks]

Grade 9 Cambridge Computer Science II July 2020 Page 8


9

8. Write an algorithm, using a pseudocode or a flowchart to,


 Input 1000 buildings
 Output how many buildings have 10 or more than 10 floors in category Q
 Output how many buildings have less than 10 floors in category Q
 Output how many buildings have 5 or more than 5 floors in category Q
 Output how many buildings have less than 5 floors in category Q

Buildings are categorized with unique codes using letters in the alphabet. Category Q consists of
buildings which have windows facing the West side and have a maximum of 20 floors

-------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------

[Total = 8 marks]

END

Ref : CP/NR

Grade 9 Cambridge Computer Science II July 2020 Page 9

You might also like