Skip to main content
EnglandComputer ScienceSyllabus dot point

What distinguishes the main programming paradigms, and what are the core principles of object-oriented programming?

Programming paradigms (procedural, low-level / assembly and object-oriented), the need for and characteristics of different levels of programming language, and the core principles of object-oriented programming: classes, objects, methods, attributes, encapsulation, inheritance and polymorphism.

An OCR H446 answer on programming paradigms and language levels: procedural, low-level and object-oriented programming, the characteristics of high-level versus low-level languages, and the OOP principles of classes, objects, methods, attributes, encapsulation, inheritance and polymorphism.

Generated by Claude Opus 4.814 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. The answer
  3. Examples in context
  4. Try this

What this dot point is asking

OCR wants the characteristics of the procedural, low-level and object-oriented paradigms, why languages exist at different levels (high-level versus low-level), and precise definitions of the OOP principles, classes, objects, methods, attributes, encapsulation, inheritance and polymorphism, with examples. Expect a definition-with-example question on OOP and a high-level versus low-level comparison.

The answer

Paradigms and language levels

Classes, objects, methods and attributes

class BankAccount:
    def __init__(self, holder, balance):
        self.__holder = holder      # private attribute
        self.__balance = balance

    def deposit(self, amount):      # method
        if amount > 0:
            self.__balance += amount

    def get_balance(self):          # accessor / getter
        return self.__balance

account = BankAccount("Asha", 100)  # object (instance)
account.deposit(50)
print(account.get_balance())        # 150

Encapsulation, inheritance and polymorphism

class Shape:
    def area(self):
        return 0

class Circle(Shape):            # inheritance
    def __init__(self, r):
        self.r = r
    def area(self):             # polymorphism (override)
        return 3.14159 * self.r ** 2

class Rectangle(Shape):
    def __init__(self, w, h):
        self.w, self.h = w, h
    def area(self):
        return self.w * self.h

for s in [Circle(2), Rectangle(3, 4)]:
    print(s.area())             # 12.566..., 12

Examples in context

Game engines model entities (players, enemies, items) as objects in an inheritance hierarchy, using polymorphism so one update loop drives them all. Operating-system device drivers and embedded firmware are often written in low-level code for direct hardware control. Procedural style still suits short scripts and numerical routines. OCR ties this to the detailed OOP programming techniques in Component 02, where you read and write class definitions, and to the trade-offs between paradigms when designing the Programming Project.

Try this

Q1. State the difference between a class and an object. [2 marks]

  • Cue. A class is a template defining attributes and methods; an object is a specific instance of that class with its own attribute values.

Q2. Explain how encapsulation protects an object's data. [2 marks]

  • Cue. Attributes are kept private and can be changed only through public methods (setters) that can validate input, preventing invalid states from outside code.

Q3. State one situation where a low-level language is more appropriate than a high-level one. [1 mark]

  • Cue. Where direct hardware control or maximum speed and memory efficiency are needed, for example a device driver or embedded firmware.

Exam-style practice questions

Practice questions written in the style of OCR exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

OCR 20206 marksExplain the object-oriented concepts of encapsulation, inheritance and polymorphism, using an example for each.
Show worked answer →

Award one mark for the concept and one for a valid example, up to six.

Encapsulation: bundling attributes and the methods that act on them inside a class, with attributes kept private and accessed through public methods (getters and setters), so internal data is protected from invalid change. Example: a BankAccount class keeps balance private and only allows changes through deposit() and withdraw().

Inheritance: a subclass inherits the attributes and methods of a superclass and can add or override its own, promoting reuse. Example: SavingsAccount inherits from BankAccount and adds an interest rate.

Polymorphism: a method call behaves differently depending on the object's actual class, often by overriding an inherited method. Example: both Circle and Square inherit a draw() method from Shape but each draws itself differently. Markers reward precise definitions and a relevant example for each.

OCR 20214 marksExplain two characteristics of a low-level language and one reason a programmer might choose a high-level language instead.
Show worked answer →

Low-level characteristics (2 marks): a low-level (assembly or machine) language uses mnemonics or binary that map closely to the processor's instruction set, giving direct control over hardware and registers and producing fast, memory-efficient code; it is processor-specific (not portable) and harder and slower to write and debug.

High-level reason (2 marks): a high-level language uses English-like statements and abstractions (loops, named variables, library functions) that are far easier and quicker to write, read and maintain, and are portable across platforms once recompiled or reinterpreted, which usually outweighs the small loss of low-level control. Markers reward two valid low-level traits plus one valid productivity/portability reason for high-level.

Related dot points

Sources & how we know this