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.
Reviewed by: AI editorial process; not yet individually human-reviewed
Have a quick question? Jump to the Q&A page
Jump to a section
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
- Types of operating system (distributed, embedded, multitasking, multiuser, real-time) and software development methodologies (waterfall, agile, extreme programming, spiral, rapid application development), with their merits and appropriate uses.
An OCR H446 answer on the types of operating system (distributed, embedded, multitasking, multiuser, real-time) and the software development methodologies (waterfall, agile, extreme programming, spiral, rapid application development), with their merits, drawbacks and appropriate uses.
- The need for, and the characteristics of, translators (assemblers, compilers, interpreters), the stages of compilation (lexical analysis, syntax analysis, code generation, optimisation), and the role of linkers, loaders and libraries.
An OCR H446 answer on translators and compilation: the characteristics of assemblers, compilers and interpreters, when each is used, the four stages of compilation (lexical analysis, syntax analysis, code generation and optimisation), and the roles of linkers, loaders and libraries.
- The nature of applications generation, the role of utilities and the difference between systems and application software, and the types and uses of software including open source versus closed source and custom-written versus off-the-shelf.
An OCR H446 answer on applications generation and the types and uses of software: the role of utilities, the difference between systems and application software, and the trade-offs of open source versus closed source and custom-written versus off-the-shelf software.
- Object-oriented programming techniques in practice: defining classes with attributes and methods, constructors and instantiation, getters and setters for encapsulation, inheritance and method overriding for polymorphism, and the benefits of an object-oriented design.
An OCR H446 answer on object-oriented programming techniques in practice: defining classes with attributes and methods, constructors and instantiation, getters and setters for encapsulation, inheritance with method overriding for polymorphism, and the benefits of object-oriented design.
- Programming techniques: sequence, selection and iteration, recursion, the use of subroutines (procedures and functions) with parameters passed by value and by reference, local and global variable scope, and the features of an integrated development environment (IDE).
An OCR H446 answer on programming techniques: sequence, selection and iteration, recursion, subroutines (procedures and functions) with parameters passed by value or by reference, local and global variable scope, and the features of an integrated development environment.