Further programming: paradigms, OOP, files and exceptions – A Level Computer Science (9618)
36 questions · page 1 of 3 · Clear filters
Question text
11
A declarative programming language is used to show which home cinema devices customers
already have and which devices they want.
01
device(projector).
02
device(large_tv).
03
device(medium_tv).
04
device(bluray_player).
05
device(amplifier).
06
device(media_player).
07
device(main_speakers).
08
device(centre_speaker).
09
device(surround_speakers).
10
customer(petrov).
11
customer(margaret).
12
customer(steffan).
13
customer(susan).
14
customer(allan).
15
customer(sammy).
16
owns(projector, petrov).
17
owns(media_player, petrov).
18
owns(projector, susan).
19
owns(projector, sammy).
20
owns(media_player, allan).
21
owns(bluray_player, steffan).
22
wants(main_speakers, margaret).
23
wants(surround_speakers, susan).
24
wants(medium_tv, steffan).
These facts (clauses) have the meanings:
fact
meaning
01
A projector is a device.
10
Petrov is a customer.
16
Petrov owns a projector.
22
Margaret wants main speakers.
(a) Betty is a customer who owns a large TV and wants a Blu‑ray player.
Write additional facts to represent this information.
25 …
26 …
27 …
[3]
© Cambridge University Press & Assessment 2026
,
,
(b) Using the variable Owner, the goal:
owns(media_player, Owner)
returns
Owner = petrov, allan
Write the result of using the goal:
owns(projector, Owner)
Owner = … [1]
(c) D may be available for A to buy if D is a device and A is a customer and A does not own
that device.
Write this as a rule:
may_buy_device(D, A)
IF …
…
…
… [4]
© Cambridge University Press & Assessment 2026
,
,
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 (Cambridge University Press & Assessment) 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 our 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 International Education is the name of our awarding body and a part of Cambridge University Press & Assessment, which is a department of the
University of Cambridge.
© Cambridge University Press & Assessment 2026
Question text
11
(a) Object-Oriented Programming (OOP) is used to design a class called Node.
A partial design of the Node class includes the STRING attribute Content and the INTEGER
attribute Pointer, together with their getters and setters.
The class also includes a constructor, with two parameters, to set the values of
these attributes.
Write pseudocode statements to declare the Node class, its attributes and the constructor.
…
…
…
…
…
…
…
…
…
… [5]
© Cambridge University Press & Assessment 2026
,
,
(b) Complete the table by filling in the missing OOP terms and descriptions.
OOP term
description
A method used to change values in private attributes in
…
a class.
…
An occurrence of a class during the execution of a program.
…
aggregation
…
…
…
inheritance
…
…
[4]
© Cambridge University Press & Assessment 2026
,
,
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 (Cambridge University Press & Assessment) 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 our 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 International Education is the name of our awarding body and a part of Cambridge University Press & Assessment, which is a department of the
University of Cambridge.
© Cambridge University Press & Assessment 2026
Question text
10 Explain what is meant by exception handling.
Include an example of a possible cause of an exception in your answer.
Explanation …
…
…
…
Example …
[3]
ĬÙú¾Ġ´íÈõÏĪÅĊàû·þ×
Question text
10 An exception is an error that may cause a program to halt unexpectedly.
(a) Describe how program termination due to an exception can be avoided.
…
…
…
…
… [2]
(b) Identify two possible causes of exceptions.
1 …
…
2 …
…
[2]
ĬÓĊ®Ġ´íÈõÏĪÅĊßùµĀ×
Question text
12 An exception can occur when running a program.
(a) Explain what is meant by an exception.
…
…
…
…
…
… [3]
(b) Identify one example of an exception and give one reason why the exception may cause a
problem.
Example …
…
Reason …
…
[2]
ĬÛú¾Ġ´íÈõÏĪÅĊàû¶Ā×
Question text
11
(a) A medical centre uses objects of the class Appointment to record treatments given and
medication prescribed during each doctor’s appointment. Some of the attributes required in
the class are listed in the table.
Attribute
Data type
Description
DateSeen
DATE
date of treatment
Treatments
STRING
treatments given
Medications
STRING
medications prescribed
Patients are identified by a unique 8-digit number, beginning with the patient’s year of birth,
for example, 20108989.
Doctors are identified by their name, for example, A N Other.
Complete the class diagram for Appointment, to include:
•
attribute and data type for the identification of the patient
•
attribute and data type for the identification of the doctor
•
methods to assign date seen, treatments given and medications prescribed
•
method to return the date seen and the attributes for the patient and the doctor.
Appointment
DateSeen
: DATE
… : …
… : …
Treatments
: STRING
Medications
: STRING
…
SetPatientID(PatientNumber : INTEGER)
SetDoctor(DoctorID : STRING)
…
…
…
…
…
GetTreatments()
GetMedications()
[5]
ĬÑĊ®Ġ´íÈõÏĪÅĊÞû¸Ā×
,
,
(b) (i)
Identify the object-oriented programming (OOP) feature whose function includes
restricting external access to the data.
… [1]
(ii)
Describe what is meant by the OOP feature inheritance.
…
…
…
… [2]
Question text
12 The pseudocode algorithm checks whether a location in a stock file StockList.dat is empty
or not. The location is given by the user. If the location is empty, a suitable message is displayed,
otherwise the item stored at that location is displayed.
Complete this file-handling pseudocode algorithm.
DECLARE Location : INTEGER
DECLARE Item : STRING
DECLARE Continue : BOOLEAN
DECLARE Answer : CHAR
TRUE
Continue
OPENFILE …
WHILE Continue
OUTPUT "Enter a location between 1 and 500: "
INPUT Location
…
GETRECORD …
IF Item = "" THEN
OUTPUT "This record is missing."
ELSE
OUTPUT "The item in stock is ", …
ENDIF
OUTPUT "Another location (Y or N)?"
INPUT Answer
IF Answer <> 'Y' THEN
FALSE
Continue
ENDIF
ENDWHILE
…
OUTPUT "End of program"
[5]
ĬÓĊ®Ġ´íÈõÏĪÅĊÞù¸Ā×
,
,
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
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 Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
ĬÍĊ®Ġ´íÈõÏĪÅĊßúµĄ×
Question text
12 (a) A medical clinic uses objects of the class Patient to assign a priority and a doctor to a
patient. Some of the attributes required in the class are listed in the table.
Attribute
Data type
Description
PatientID
STRING
Unique identifier of the patient
Name
STRING
Patient’s full name, surname first
DoctorID
STRING
ID of doctor administering treatment
Treatment is prioritised with a numeric scale of 1 to 5.
Complete the class diagram for Patient, to include:
•
attribute and data type for the date of birth
•
attribute and data type for the priority
•
methods to assign the patient ID, priority and doctor ID
•
methods to return the patient ID, patient date of birth and the priority.
Patient
PatientID
: STRING
Name
: STRING
… : …
… : …
DoctorID
: STRING
…
SetName(FullName : STRING)
SetDateOfBirth(DOB : DATE)
…
…
…
GetName()
…
…
GetDoctorID()
[5]
ĬÑĊ®Ġ´íÈõÏĪÅĊàù¸Ā×
,
,
(b) (i)
Identify the object-oriented programming (OOP) term described as ‘an occurrence of an
object’.
… [1]
(ii)
Describe what is meant by the OOP term polymorphism.
…
…
…
… [2]
Question text
13 The pseudocode algorithm below uses random file access to copy 50 records from a live file
CurrentResults.dat to a stored file StoredResults.dat one record at a time. It uses the
user-defined type StudentResult.
TYPE StudentResult
DECLARE LastName : STRING
DECLARE FirstName : STRING
DECLARE ExamGrade : STRING
ENDTYPE
If any grades are missing in CurrentResults.dat, the text "Missing grade" is added to the
ExamGrade field in StoredResults.dat
Complete this file handling pseudocode algorithm.
DECLARE Grade : StudentResult
DECLARE Position : INTEGER
…
OPENFILE "StoredResults.dat" FOR RANDOM
…
SEEK "CurrentResults.dat", Position
GETRECORD "CurrentResults.dat", Grade
IF Grade.ExamGrade = "" THEN
…
ENDIF
…
…
NEXT Position
CLOSEFILE "CurrentResults.dat"
CLOSEFILE "StoredResults.dat"
[5]
ĬÓĊ®Ġ´íÈõÏĪÅĊàû¸Ā×
,
,
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
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 Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
ĬÍĊ®Ġ´íÈõÏĪÅĊÝüµĄ×
Question text
5
Complete the table by filling in the missing object-oriented programming (OOP) terms and
descriptions.
OOP term
Description
A method that accesses the value of a property.
…
A method that changes the value of a property.
…
…
Object
…
…
…
Method
…
…
[4]
Question text
11
The pseudocode algorithm below allows a user to input a new stock item. The random file is
searched for the next empty location in the file and the new item is inserted there.
A suitable message is displayed if the file is full.
Complete this pseudocode.
DECLARE Location : INTEGER
DECLARE NewStock : STRING
DECLARE CurrentStock : STRING
DECLARE Stored : BOOLEAN
DECLARE Max : INTEGER
←
100000
Max
←
FALSE
Stored
←
1
Location
…
OUTPUT "Enter the new item you wish to store: "
INPUT NewStock
WHILE NOT Stored AND Location <= Max
…
GETRECORD "StockList.dat", …
IF CurrentStock = "" THEN
… "StockList.dat", NewStock
←
TRUE
Stored
ELSE
←
Location + 1
Location
ENDIF
ENDWHILE
… THEN
OUTPUT "The new item has not been stored as the file was full."
ENDIF
CLOSEFILE "StockList.dat"
[5]
ĬÓĊ®Ġ´íÈõÏĪÅĊßú¸Ā×
Question text
3
(a) Describe circuit switching as a method of data transmission.
…
…
…
…
…
… [3]
(b) State one benefit and one drawback of circuit switching as a method of data transmission.
Benefit …
…
Drawback …
…
[2]
ĬÏĊ®Ġ´íÈõÏĪÅĊÞú¸þ×
Question text
9
A veterinary surgery wants to create a class for individual pets.
Some of the attributes required in the class are listed in the table.
Attribute
Data type
Description
PetID
STRING
unique ID assigned at registration
PetType
STRING
type of pet assigned at registration
telephone number of owner assigned at
OwnerTelephone
STRING
registration
DateRegistered
DATE
date of registration
(a) State one reason why the attributes would be declared as PRIVATE.
…
… [1]
(b) Complete the class diagram for Pet, to include:
•
an attribute and data type for the name of the pet
•
an attribute and data type for the name of the owner
•
a method to create a Pet object and set attributes at the time of registration
•
a method to assign a pet ID
•
a method to assign the date of registration
•
a method to return the pet name
•
a method to return the owner’s telephone number.
Pet
PetID
: STRING
PetType
: STRING
OwnerTelephone
: STRING
DateRegistered
: DATE
… : …
… : …
…
…
…
…
…
[5]
ĬÓĊ®Ġ´íÈõÏĪÅĊßüµĀ×
Question text
10 Objects and classes form the basic structure of Object‑Oriented Programming (OOP).
(a) Outline the structure of a class.
…
…
…
…
…
… [3]
(b) Give three differences between an object and a class.
1 …
…
…
2 …
…
…
3 …
…
…
[3]
ĬÓĊ®Ġ´íÈõÏĪÅĊÞû¸þ×
Question text
3
(a) Describe circuit switching as a method of data transmission.
…
…
…
…
…
… [3]
(b) State one benefit and one drawback of circuit switching as a method of data transmission.
Benefit …
…
Drawback …
…
[2]
ĬÏĊ®Ġ´íÈõÏĪÅĊÝû¸þ×