9618 · 20.1
Programming Paradigms flashcards
Revision flashcards for Cambridge 9618 Programming Paradigms (syllabus 20.1). Flip, recall, then mark a real past-paper question.
Card
What is a programming paradigm?
A style or 'way of thinking' for structuring computer programs. It's a set of concepts and practices that shapes how you solve problems with code.
Card
What is the core idea of the Imperative paradigm?
It describes computation in terms of statements that change a program's state. You explicitly tell the computer *how* to accomplish a task, step-by-step.
Card
What is the core idea of the Declarative paradigm?
It describes the desired result or logic of a computation without specifying the control flow. You tell the computer *what* you want to achieve, not how to do it.
Card
What is a Procedural language?
A type of imperative language where programs are structured as a sequence of procedures or subroutines that call each other. Data and procedures are typically separate. Examples: C, Pascal, classic BASIC.
Card
What is an Object-Oriented language?
A type of imperative language that bundles data (attributes) and the methods that operate on that data into 'objects'. Examples: Java, Python, C++.
Card
Define Encapsulation in OOP.
The bundling of data (attributes) and methods that operate on that data into a single unit (a class/object). It also involves restricting direct access to some of an object's components (information hiding).
Card
Define Inheritance in OOP.
A mechanism where a new class (subclass/child class) derives properties and behaviours (attributes and methods) from an existing class (superclass/parent class).
Card
Define Polymorphism in OOP.
Literally 'many forms'. The ability of a method or object to be processed in different ways. For example, a `draw()` method could work differently for `Circle` and `Square` objects.
Card
What is a Low-Level paradigm?
A programming paradigm that provides little or no abstraction from a computer's instruction set architecture. It deals with hardware-specific operations. Assembly language is the primary example.
Card
Common Trap: Is Python a procedural or object-oriented language?
It's a multi-paradigm language. You can write procedural-style code, but it is fundamentally object-oriented (e.g., even integers are objects). For the exam, code using classes is OOP; code using only functions is procedural.
Card
What is a 'side effect' in programming?
A side effect occurs when a function or expression modifies some state outside its local environment, e.g., modifying a global variable. Imperative programming relies heavily on side effects.