Practice Questions
A Level Computer Science: Further Programming (A Level) — Practice Questions (Cambridge 9618)
Practice questions with worked answers for Cambridge A Level Computer Science 9618: OOP classes and inheritance, declarative rules, random files, exceptions.
- Subject
- Computer Science
- Level
- A LEVEL
- Topic
- Further Programming
- Author
- Marlbridge Academic Team
- Updated
- Reviewed by
- Harris Khan (what this means)
Aligned to Cambridge A Level Computer Science (9618), 2026. Official specification .
Syllabus page (what it covers and how it is assessed): Cambridge A Level Computer Science.
Syllabus points this page covers
9618 (A Level)
- 20.1 Programming Paradigms
- 20.2 File Processing and Exception Handling
This page covers all 2 subtopics recorded here in topic 20, Further Programming.
Found an error? Report a correction.
Need help with this topic? Request a free trial class for A Level Computer Science (9618).
These are original questions written for Marlbridge, for revision and practice on this content. They are not reproduced past-paper questions, and they do not replicate the exam’s exact structure, question count or mark tariffs — Cambridge International holds copyright in its own papers. Use these alongside the official past papers available from your board.
Each question practises a skill tested in the June 2025 Paper 31. After each answer there is an examiner insight, a mark-scheme insight or a tip, and the real question to try next where one matches.
Questions
1. A city bike-hire scheme uses objects of the class Bicycle. The class already has the private attribute Colour : STRING and the method SetBikeID(IDNumber : INTEGER). Each bicycle is identified by a unique six-digit number, and the class must also record the name of the docking station where the bicycle is currently parked. Write the attributes and methods still needed for the class, with data types, to include: an attribute for the bicycle’s identification number, an attribute for the station name, setters for the colour and the station, and getters for the identification number, the colour and the station. [4]
2. A class, Bicycle, has the attributes BikeID, Colour and Station. All of these attributes are declared PRIVATE and can only be changed through the class’s methods.
(a) Identify the object-oriented programming (OOP) feature this describes.
(b) A new class, ElectricBicycle, is created from Bicycle and adds an attribute for battery level. Describe what is meant by inheritance, using these classes. [3]
3. Both Bicycle and ElectricBicycle have a method called CalculateHireCost(). Explain how this is an example of polymorphism. [2]
4. A cinema stores one record for each seat in a random file called Seats.dat. The record for a seat is stored at the position given by its seat number. The variable NewBooking, of the user-defined type SeatRecord, already holds the updated details for the seat whose number is stored in the integer variable SeatNum. Write pseudocode statements to open Seats.dat, store NewBooking at the correct position, and close the file. [4]
5. A program asks the user for the name of a file and then opens it to read the data.
(a) Explain what is meant by an exception.
(b) Describe how exception handling could be used in this program. [3]
6. A declarative program contains these facts:
speaks(ayesha, urdu). speaks(ayesha, english). speaks(bilal, arabic). speaks(chen, english).
(a) State the result of the query speaks(X, english).
(b) Write a rule, can_talk(A, B), that is true when person A and person B speak the same language. [3]
Answers
1. Attributes: BikeID : INTEGER and Station : STRING [1]. Setters: SetColour(NewColour : STRING) and SetStation(NewStation : STRING) [1], each with a parameter name that is different from the attribute it sets [1]. Getters: GetBikeID(), GetColour() and GetStation() [1].
Examiner insight (June 2025): a common error was inconsistent naming: the attribute name should match the name used in its setter and getter (SetBikeID implies an attribute BikeID and a getter GetBikeID()), and each setter’s parameter should have a different name from the attribute.
Try the real question next: Cambridge International AS & A Level Computer Science 9618, June 2025, Paper 31, Question 11.
2. (a) Encapsulation [1].
(b) Inheritance is where a subclass (derived class) takes on the attributes and methods of a parent (base or super) class: ElectricBicycle automatically has BikeID, Colour, Station and their methods from Bicycle [1]. The subclass can add its own attributes and methods, such as BatteryLevel, and can override inherited methods to change how they work [1].
Mark-scheme insight (Cambridge 9618 June 2025 mark scheme, Paper 31, Question 11(b)(ii)): credit was given for saying a derived class takes the attributes and methods of a parent class, and for saying that these inherited members can be extended or overridden in the subclass.
Source for the mark-scheme insights on this page: Cambridge International AS & A Level Computer Science 9618 June 2025 mark scheme for Paper 31 (9618/31), paraphrased. This mark scheme is not published on Cambridge’s 9618 past papers page (checked September 2026).
Try the real question next: Cambridge International AS & A Level Computer Science 9618, June 2025, Paper 31, Question 11.
3. Polymorphism means a method with the same name behaves differently depending on the class of the object it is called on [1]. ElectricBicycle overrides CalculateHireCost() inherited from Bicycle (for example adding a charge for battery use), so calling CalculateHireCost() on each object runs the version belonging to that object’s class [1].
Tip: polymorphism questions usually expect the word override and a link to inheritance: the subclass redefines a method it inherited.
4.
OPENFILE "Seats.dat" FOR RANDOM
SEEK "Seats.dat", SeatNum
PUTRECORD "Seats.dat", NewBooking
CLOSEFILE "Seats.dat"
Opening the file FOR RANDOM [1]; SEEK to the position SeatNum [1]; PUTRECORD to write NewBooking [1]; CLOSEFILE at the end [1].
Examiner insight (June 2025): candidates who knew the file-handling statements in the published pseudocode guide scored most highly on the matching algorithm, so learn the exact keywords OPENFILE … FOR RANDOM, SEEK, GETRECORD, PUTRECORD and CLOSEFILE.
Try the real question next: Cambridge International AS & A Level Computer Science 9618, June 2025, Paper 31, Question 12.
5. (a) An exception is an unexpected event or error that occurs while the program is running (at run time) and would otherwise make it crash, such as trying to open a file that does not exist [1].
(b) The statements that open and read the file are placed in a TRY block [1]; if an exception is raised, control passes to an EXCEPT (catch) block, which shows a helpful message such as “File not found” and lets the user enter another name instead of the program crashing [1].
Tip: link exception handling to the scenario: name a specific run-time error the program could meet and say what the handler does about it.
6. (a) X = ayesha and X = chen [1]
(b) can_talk(A, B) IF speaks(A, L) AND speaks(B, L). — using a shared variable, L, for the language in both conditions [1], joined correctly with IF and AND [1]. (Adding AND A <> B to stop a person matching themselves is also acceptable.)
Tip: in a declarative rule, using the same variable in two conditions is what forces the values to match; this is the key idea in most rule-writing questions.
Where marks are usually lost
- Naming an attribute differently from its getter and setter, or giving a setter parameter the same name as the attribute.
- Leaving out data types for attributes and setter parameters.
- Describing inheritance without saying that the subclass can add to or override what it inherits.
- Using made-up file-handling keywords instead of those in the pseudocode guide, or forgetting to open the file FOR RANDOM before SEEK.
- Forgetting to close the file at the end of a file-handling algorithm.
Frequently asked questions
What is encapsulation in object-oriented programming? Encapsulation is where a class’s attributes are declared private so they can only be accessed or changed through the class’s own methods.
What is the difference between inheritance and polymorphism? Inheritance is where a subclass takes on the attributes and methods of a parent class and can add its own. Polymorphism is where a method with the same name behaves differently depending on the object’s class, usually because the subclass overrides it.
What file-handling keywords are used for random files in Cambridge pseudocode? OPENFILE … FOR RANDOM, SEEK, GETRECORD, PUTRECORD and CLOSEFILE. Using made-up keywords instead of those in the pseudocode guide is a common way to lose marks.
What is an exception? An exception is an unexpected event or error that happens while a program is running, such as trying to open a file that does not exist. Exception handling puts the risky code in a TRY block and deals with the error in an EXCEPT block.
Get free revision emails (optional)
Occasional emails with practice questions, worked explanations and links to free resources for the qualification and subjects you choose. No spam, and you can unsubscribe from any email. The free tools on this site never need an email.
Related resources
-
Revision notes
A Level Computer Science: Further Programming (A Level) — Revision Notes (Cambridge 9618)
Notes on paradigms, addressing modes, OOP terms, facts, rules and goals, serial, sequential and random files and exception handling for Cambridge 9618.
Computer Science · Cambridge · A Level
Revise topic -
Study guides
A Level Computer Science: Further Programming (A Level) (Cambridge 9618)
Guide to low-level, procedural, object-oriented and declarative paradigms, serial, sequential and random file processing and exceptions for Cambridge 9618.
Computer Science · Cambridge · A Level
Read guide -
Study guides
A Level Computer Science: Information Representation (Cambridge 9618)
Guide to Topic 1 of Cambridge AS Computer Science 9618: base conversion, two's complement, image and sound file sizes, bitmaps, vectors and compression.
Computer Science · Cambridge · AS Level
Read guide
Related articles
-
teaching
A Level tuition in Dubai: Cambridge or Pearson Edexcel International A Level?
Schools in Dubai and Abu Dhabi teach either Cambridge International AS & A Level or Pearson Edexcel International A Level. How the two are structured, why it matters for tuition, and how online classes from Lahore work.
9 October 2026
-
curriculum guides
Choosing subjects at IGCSE and A Level
How subject choices at 14 and 16 affect university options later, and how to keep pathways open without overloading a timetable.
28 July 2026
Studying this with a teacher
Working through Computer Science A LEVEL?
This page is free and stays free. If you would rather be taught it, Marlbridge runs Computer Science classes one-to-one and in small groups of up to 15, online in your own time zone. The first trial class is free. WhatsApp replies within an hour (8am–11pm Pakistan time, every day); email the same day.
Cambridge Computer Science teachers at Marlbridge