Professional Documents
Culture Documents
COMPUTER SCIENCE
PAPER II
9 (Cambridge) ..........
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]
(i) What validation checks should be used for the maximum temperature given and the
temperatures good for the plants?
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
(2 marks)
[Total = 4 marks]
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
3 INPUT tot_bill
5 count count + 1
6 NEXT count
7 OUTPUT final_amount
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.
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
[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)
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]
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
count count + 1
Is
Yes No
count < = 10 ? OUTPUT totcost
END
24 , 36 , 12 , 18 , 9 , 18 , 14 , 35 , 18 , 10
[Total = 5 marks]
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