Signed up recently but had issues with the confirmation email?

Click Forgot password and follow the reset steps. You can choose the same password you used when you signed up. This should then provide access.

Remember to check Spam and Junk. The email will be from auth@progressbytes.co.uk.

Revision notesQuestionsFor schools
Revise Computing
Log inStart revising free
Revision notesQuestionsFor schoolsLog in

© 2026 Revise Computing · revisecomputing.co.uk

Worried about something?Question Bank UpdatesPrivacy noticeTermsContact

Revise Computing is an independent revision resource. It is not affiliated with, or endorsed by, OCR (Oxford Cambridge and RSA Examinations).

Knowledge/A Level/H446/02 Algorithms and programming/Programming Techniques/Use of object oriented techniques

Use of object oriented techniques

Use of object oriented techniques.

2.2.1 Programming Techniques

Practise exam questions

Programming Techniques — Note 6 of 6

Candidates need to understand classes, objects, attributes, methods, encapsulation (including get and set methods), inheritance and polymorphism. Candidates need to be able to read, trace and write object-oriented code, interpret class diagrams to produce class definitions, and derive an object-oriented solution for a given scenario.

What you need to know

Object-oriented techniques are used to design and write programs as collections of interacting objects. You need to read, trace and write OOP code, interpret class diagrams, and decide when an object-oriented approach suits a problem.

What to know

  • Classes define attributes and methods; objects are instances of classes created with a constructor.
  • Encapsulation: attributes are private and accessed through public getter and setter methods, so data can be validated and protected.
  • Inheritance: a subclass inherits from a superclass and can add or override attributes and methods, avoiding duplicated code.
  • Polymorphism: the same method call behaves differently depending on the object's class, e.g. each subclass overriding draw().
  • OOP suits problems with many interacting entities (e.g. games, simulations, user interfaces), and supports reuse and teamwork because classes can be developed and tested separately.

Code examples

Encapsulation, inheritance and polymorphism in Python
python
class Shape:
    def __init__(self, name):
        self.__name = name           # private attribute

    def get_name(self):              # getter
        return self.__name

    def area(self):
        return 0

class Rectangle(Shape):             # inheritance
    def __init__(self, width, height):
        super().__init__("Rectangle")
        self.width = width
        self.height = height

    def area(self):                  # overrides Shape.area (polymorphism)
        return self.width * self.height

shapes = [Shape("Blank"), Rectangle(3, 4)]
for s in shapes:
    print(s.get_name(), s.area())    # Blank 0, then Rectangle 12

Key terms

Class diagram

A diagram showing each class's name, attributes and methods (with + for public and - for private), and arrows showing inheritance.

Exam technique

  • Tip:You may need to turn a class diagram into a class definition, or derive an object-oriented solution for a scenario.
  • Tip:A subclass constructor takes the parent's values as well as its own. It passes the parent's values on with super.new(...), then sets its new attributes. Don't assign the parent's private attributes directly from the subclass.
  • Tip:Use the class, attribute and method names the question gives, and call its existing methods (e.g. its getters) rather than inventing ones such as .length(). Write in pseudocode or one language, not a mix.
  • Tip:To create an object, use new with the class name and the constructor's arguments in order, strings in quotes, e.g. boat = new Boat("Swift", 4). In a main program, store or test the value each FUNCTION method returns before you act on it.
  • Mistake:Accessing a private attribute directly from outside its class instead of using a getter or setter.
  • Mistake:Writing a getter that prints the value, asks for input, changes the attribute, takes parameters it doesn't need, or is declared private or as a procedure. A getter is a PUBLIC FUNCTION that returns the attribute unchanged, e.g. public function getSpeed() return speed endfunction. It only takes a parameter when it returns one element of an array attribute, e.g. getSeat(row) returns seats[row]. A setter takes the new value as a parameter; it doesn't input it.
  • Mistake:Putting parameters on the class header, writing givenName = name the wrong way round, or using input in the constructor. Parameters belong to new(...), each is assigned TO its attribute (name = givenName), and fixed starting values are set inside it, not passed in. If asked for the class declaration AND the constructor, write both: the class ... endclass lines with the attributes, and public procedure new(...) inside.

Past exam questions

  • June 2026Paper 2Q9(b)(ii)2marks
  • June 2026Paper 2Q9(c)(i)4marks
  • June 2026Paper 2Q9(c)(ii)2marks
  • June 2026Paper 2Q9(d)(i)3marks
  • June 2026Paper 2Q9(d)(ii)3marks
  • June 2026Paper 2Q9(f)8marks
  • June 2025Paper 2Q8(b)(i)2marks
  • June 2025Paper 2Q8(b)(ii)3marks
  • June 2025Paper 2Q8(c)(i)2marks
  • June 2025Paper 2Q8(d)5marks
  • June 2024Paper 1Q95marks
  • June 2024Paper 2Q9(b)(i)2marks
  • June 2024Paper 2Q9(b)(ii)3marks
  • June 2024Paper 2Q9(c)(i)5marks
  • June 2024Paper 2Q9(c)(ii)5marks
  • June 2024Paper 2Q9(d)6marks
  • June 2023Paper 2Q9(b)(i)5marks
  • June 2023Paper 2Q9(b)(ii)2marks
  • June 2023Paper 2Q9(c)5marks
  • June 2023Paper 2Q9(d)7marks
  • June 2022Paper 1Q2(g)(i)7marks
  • June 2022Paper 1Q2(g)(ii)2marks
  • June 2022Paper 2Q8(b)(iii)2marks
  • June 2022Paper 2Q8(b)(iv)4marks
  • June 2022Paper 2Q8(b)(v)8marks
  • November 2021Paper 1Q7(c)(ii)5marks
  • November 2021Paper 2Q5(c)5marks
  • November 2021Paper 2Q5(d)6marks
  • November 2021Paper 2Q5(e)4marks
  • November 2021Paper 2Q5(f)4marks
  • November 2020Paper 1Q2(a)(i)4marks
  • November 2020Paper 1Q2(a)(ii)3marks
  • November 2020Paper 1Q2(a)(iii)3marks
  • November 2020Paper 2Q6(b)(i)4marks
  • June 2019Paper 2Q7(b)(i)4marks
  • June 2019Paper 2Q7(b)(ii)5marks
  • June 2019Paper 2Q7(b)(iii)4marks
  • June 2019Paper 2Q7(b)(iv)4marks
  • June 2019Paper 2Q7(b)(v)6marks
  • June 2018Paper 1Q7(b)(i)2marks
  • June 2018Paper 1Q7(c)5marks
  • June 2018Paper 2Q6(b)(iii)2marks
  • June 2018Paper 2Q6(b)(v)1mark
  • June 2018Paper 2Q6(b)(vi)5marks
  • June 2017Paper 2Q6(d)(i)4marks
  • June 2017Paper 2Q6(d)(ii)2marks
  • June 2017Paper 2Q6(d)(iii)5marks

Ready to test yourself?

Practise 2.2.1 questions
← Previous noteUse of an IDE to develop/debug a program2.2.1 Programming TechniquesNext topic →Features that make a problem solvable by computational methods2.2.2 Computational Methods

Back to Programming Techniques

Programming Techniques

Note 6 of 6

  1. 1Programming constructs: sequence, iteration, branching
  2. 2Recursion, how it can be used and how it compares to an iterative approach
  3. 3Global and local variables
  4. 4Modularity, functions and procedures, parameter passing by value and by reference
  5. 5Use of an IDE to develop/debug a program
  6. 6Use of object oriented techniques
Topic overview