Professional Documents
Culture Documents
* 8 8 8 9 0 3 8 2 6 4 *
2 hours
INSTRUCTIONS
● Answer all questions.
● Use a black or dark blue pen.
● Write your name, centre number and candidate number in the boxes at the top of the page.
● Write your answer to each question in the space provided.
● Do not use an erasable pen or correction fluid.
● Do not write on any bar codes.
● You may use an HB pencil for any diagrams, graphs or rough working.
● Calculators must not be used in this paper.
INFORMATION
● The total mark for this paper is 75.
● The number of marks for each question or part question is shown in brackets [ ].
● No marks will be awarded for using brand names of software packages or hardware.
DC (JP) 199349
© UCLES 2020 [Turn over
2
...................................................................................................................................................
............................................................................................................................................. [1]
(b) Give three situations where an exception handling routine would be required.
1 ................................................................................................................................................
...................................................................................................................................................
2 ................................................................................................................................................
...................................................................................................................................................
3 ................................................................................................................................................
...................................................................................................................................................
[3]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
Tick (✓) one or more boxes to show the features that must be included in a valid recursive
algorithm.
Incrementation
General case
Base case
Selection case
It calls itself
[2]
(b) The following recursive procedure outputs every even number from the positive parameter
value down to and including 2.
The procedure checks if the integer parameter is an even or an odd number. If the number is
odd, the procedure converts it to an even number by subtracting 1 from it.
IF …………………………………(Number, 2) <> 0
THEN
Number Number – 1
ENDIF
OUTPUT ……………………………………………………………
IF Number > 0
THEN
…………………………………(………………………………… – 1)
ENDIF
ENDPROCEDURE
[5]
The program will keep count of the numbers of each meal option chosen.
The program ends when a value other than 1 or 2 is entered. It then outputs the count of each
meal option.
MoreMeals True
INPUT MealOption
IF MealOption = 1
THEN
MealOption1 MealOption1 + 1
ELSE
IF MealOption = 2
THEN
MealOption2 MealOption2 + 1
ELSE
MoreMeals False
ENDIF
ENDIF
ENDWHILE
ENDPROCEDURE
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
ENDPROCEDURE
[5]
01 person(jessica).
02 person(pradeep).
03 person(steffi).
04 person(johann).
05 sport(football).
06 sport(hockey).
07 sport(cricket).
08 sport(volleyball).
09 plays(johann, football).
10 plays(steffi, cricket).
11 plays(jessica, football).
12 will_not_play(pradeep, cricket).
Clause Meaning
01 Jessica is a person
05 Football is a sport
(a) Elle is a person who plays rugby but refuses to play hockey.
13 .............................................................................................................................................
14 .............................................................................................................................................
15 .............................................................................................................................................
16 .............................................................................................................................................
[4]
plays(X, football).
X = ..................................................................................................................................... [1]
(c) Y might play X, if Y is a person, X is a sport and Y does not refuse to play X.
mightplay(Y , X)
IF .............................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [5]
4 Object-oriented programming has several features. These include inheritance, classes, methods
and properties.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
1 ................................................................................................................................................
2 ................................................................................................................................................
[2]
5 A tennis club is developing a program to store details of the lessons it offers. The programmer has
designed the class Lesson for the details of the lessons.
The following class diagram shows the design for the Lesson class.
Lesson
Use the appropriate constructor method for your chosen programming language.
Program code
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
Program code
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
(c) Fee is the cost that a customer will pay for a lesson.
The method GetFee() validates the parameter value. The method is sent a parameter value
that represents the skill level of the customer: beginner, intermediate or advanced.
The method must check the parameter value is a valid character ('B', 'I' or 'A') and
return the correct fee. It must return -1 if it is not a valid character.
Program code
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [5]
(d) The tennis club only offers nine different types of lesson. The lesson objects are stored in a
1D array.
Write pseudocode to declare an array LessonArray to store the nine lesson objects.
...................................................................................................................................................
............................................................................................................................................. [2]
(e) The tennis club has the lesson ‘Improve Your Serve’ that has David as the instructor.
Write program code to create the lesson ‘Improve Your Serve’ as an instance of the class
Lesson. The object needs to be stored in the third element of the array LessonArray.
Program code
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
6 A theatre company stores customer login details to allow customers to book tickets online.
TYPE CustomerRecord
ENDTYPE
(a) The procedure InitialiseHashTable() initialises the hash table. UserID is initialised as
an empty string, and PINNumber initialised to 0 for all of the records.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [4]
(b) The function InsertRecord() is used to insert a new record into the hash table.
If the hash table is full, the function InsertRecord() returns -1. If there is space available
in the hash table, the record is inserted, and it returns the position of this record in the array.
Count 0
Index Hash(…………………………………………………………………………………………………)
Index Index + 1
Count Count + 1
THEN
…………………………………………………………………………
ENDIF
ENDWHILE
THEN
…………………………………………………………………
ELSE
CustomerDetails[…………………………………………………] …………………………………………
…………………………………………………………………
ENDIF
ENDFUNCTION
[7]
7 (a) A shirt design company has an order form to order shirts. Customers can order multiple shirts
using the same form.
• name
• address
• telephone number.
• shirt ID
• colour
• cost.
The cost of each shirt is dependent on the size ordered. The sizes customers can order are
small, medium and large.
Complete the following JSP data structure diagram for the order form.
Order Form
[7]
(b) Each customer’s order is stored as a record in a file. The customers’ orders are stored in the
order in which they arrive in the file and no key field is used.
..................................................................................................................................... [1]
1 ........................................................................................................................................
2 ........................................................................................................................................
[2]
(c) The procedure UpdateTelephone() allows the shirt company to update the record for a
customer’s details. The procedure will update the telephone number.
TYPE Customer
Name : STRING
Address : STRING
TelephoneNumber : STRING
ENDTYPE
The procedure UpdateTelephone() takes the customer record to be updated and the new
telephone number as parameters. It then updates the telephone number in the record.
…………………………………………………………………………………………………………………………………………………………………………
ENDPROCEDURE
[3]
(d) The shirt company is looking to implement a system to reward customers. The system
includes:
Monday Y Y N N Y Y N N
Loyalty card Y N Y N Y N Y N
Additional 5% discount
10% discount
Actions
Free gift
Free delivery
[4]
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of the University of
Cambridge Local Examinations Syndicate (UCLES), which itself is a department of the University of Cambridge.