Six original Cambridge-style questions on object-oriented programming in 9618 pseudocode, from terminology to writing and designing classes, with mark-scheme solutions.
Explain the meaning of each of these OOP terms: (a) instance (b) encapsulation (c) getter (d) inheritance.
A class Pupil has private attributes PupilName (a string) and Score (an integer). Write pseudocode for the class, including: a constructor that takes the name and sets Score to 0; a getter for Score; a setter SetScore that only accepts a score from 0 to 100 inclusive.
A class Prefect inherits from Pupil and has an extra private attribute Duty (a string). Write the class header, the attribute declaration and the constructor, which takes a name and a duty.
Using the Pupil class from question 2, state the output of:
P1 ← NEW Pupil("Amir")
P1.SetScore(72)
P1.SetScore(130)
OUTPUT P1.GetScore()
P2 ← NEW Pupil("Bea")
OUTPUT P2.GetScore()Explain, with an example, what is meant by polymorphism.
A garage system records vehicles. Every vehicle has a registration and a year. Cars also have a number of doors and vans have a load capacity. A garage stores up to 50 vehicles. Describe a suitable class design, naming the classes, their relationships and the attributes of each.
Mark this once you have attempted all six and checked your working. It records a Practiced badge on the topic and adds a one-time bonus. Revealing the solutions alone does not count.