Paper 1 OOP Drills
These are original Paper 1-style practice questions. They use concrete OOP scenarios so the answers can be checked exactly.
Detailed answers are in Paper 1 OOP Answers.
Revise the topic hub first:
Questions
Question 1: Class vs Object
In a library program, Book is defined with attributes title and copies. The program creates:
book1 = Book("Algorithms", 3)Identify the class and the object, and explain the difference. [2]
Question 2: Attributes and Methods
A Student class stores student_id, name, and mark. It can update the mark and report whether the student has passed.
State three suitable attributes and suggest two suitable method names for this class. [5]
Question 3: Encapsulation
A BankAccount object stores a private-style attribute _balance. Directly setting _balance = -500 would make the account invalid.
Explain why the balance should be changed through a method such as withdraw(amount) instead of direct access. [3]
Question 4: Inheritance
A school system has classes Person, Student, and Teacher.
Student and Teacher both have name and email. Student also has class_name. Teacher also has department.
Describe the inheritance relationship and state which attributes belong in the superclass. [4]
Question 5: Polymorphism
EmailNotification and SMSNotification are subclasses of Notification. Both implement a method named send().
For:
EmailNotification.send() -> "email sent"
SMSNotification.send() -> "sms sent"Explain how this is polymorphism. [3]
Question 6: Implementation Independence
A BankAccount class currently stores one internal _balance value. Other code uses only these public methods:
deposit(amount)
withdraw(amount)
get_balance()Later, the class may change its internal implementation to store a list of transaction amounts instead of one _balance value. The public method names and behaviour remain the same.
Explain why code using BankAccount may not need to change, and name the OOP idea involved. [5]
Question 7: Generalisation
Two classes have these attributes:
PrintedBook: title, author, pages, shelf
EBook: title, author, pages, file_sizeSuggest a superclass and state which attributes should be moved into it. [3]
Question 8: Scenario Update
An existing design has superclass Vehicle and subclasses Car and Bus. All vehicles have registration and speed. Car has num_doors; Bus has capacity.
A new Taxi type is needed with registration, speed, and licence_number.
Explain how to update the design. [3]
Question 9: Benefits
Using the Vehicle, Car, Bus, and Taxi design, give two benefits of using inheritance in this scenario. [2]
Question 10: Class Attribute vs Instance Attribute
A Student class stores each student’s name. It also needs to keep a shared count of how many Student objects have been created.
For the following objects:
s1 = Student("Aisha")
s2 = Student("Bo")State whether name and count should be instance attributes or class attributes, and explain why. [4]
Review Checklist
After attempting these questions, check whether you can:
- distinguish class, object, attribute, and method in a concrete scenario;
- explain encapsulation as controlled state change;
- identify superclass/subclass relationships;
- explain polymorphism as the same method call with subclass-specific behaviour;
- explain implementation independence;
- distinguish instance attributes from class attributes.