OCR A-Level Computer Science H446
Processors: Structure, Performance and Types
Input, Output and Storage
Systems Software
Applications Generation
Software Development
Types of Programming Language
Exchanging Data
Networks
Web Technologies
Data Types and Number Representation
Data Structures
Boolean Algebra
Legal, Moral, Cultural and Ethical Issues
Elements of Computational Thinking
Problem Solving and Programming
Algorithms
Types of Programming Language
Programming paradigms and procedural languages
- 3 things to know
- Component 01
Overview
Recall questions on programming paradigms and why more than one is needed, procedural languages and their features, object-oriented, declarative, functional, logic and event-driven paradigms, low-level languages, and multi-paradigm languages.
What you need to know
Answer each one before you reveal it.
What characterises a declarative paradigm, and how does it differ from an imperative one?
What characterises the logic paradigm?
Questions from this subtopic
Each one with the model answer underneath.
- 1
What is a programming paradigm?
Model answer
A style or approach to programming - a whole way of thinking about how a program should be organised and what a program fundamentally is. It determines how the problem is broken down, how data and instructions are represented and how the flow of the program is controlled, rather than merely which keywords are typed.
- 2
Why is there a need for more than one programming paradigm?
Model answer
Different kinds of problem have different natural shapes, and a paradigm that fits the shape of the problem produces code that is shorter, clearer and less likely to be wrong. Controlling a machine step by step suits a procedural approach; modelling a system of interacting real-world things suits objects; expressing a set of facts and rules and letting the machine search suits a declarative approach; responding to unpredictable user actions suits an event-driven one. Hardware and the size of projects have also changed over time, and paradigms developed to manage the growing complexity.
- 3
What characterises the procedural paradigm?
Model answer
The program is a sequence of instructions telling the computer step by step what to do, in a stated order, using the three basic constructs of sequence, selection and iteration. Data is held in variables that the instructions read and change, and the instructions are grouped into procedures and functions that can be called from elsewhere. It is imperative: the code says how the task is to be carried out.
- 4
Name three features you would expect to find in a procedural language.
Model answer
Variables and data types for storing values; the control constructs of sequence, selection and iteration; subroutines - procedures and functions - with parameters and local variables; and usually arrays and other structured data types. Examples of procedural languages include C, Pascal and Python used in a procedural style.
- 5
What characterises the object-oriented paradigm?
Model answer
The program is organised as a set of objects that each bundle together their own data and the operations that act on it, and that interact by calling one another's methods. Objects are created from classes, which act as templates, and classes can inherit from other classes. Data is deliberately hidden inside objects rather than being globally available.
- 6
What characterises a declarative paradigm, and how does it differ from an imperative one?
Model answer
A declarative program states what is wanted rather than how to obtain it, leaving the system to work out the steps. An imperative program - procedural or object-oriented - spells out the sequence of operations. A database query that asks for all customers in a given town is declarative; a loop that examines each record in turn and adds the matching ones to a list is imperative.
Other ways to work this
The same content, four other ways.
What is inside Levo
Six ways to work the same material.
Every question in Types of Programming Language, on a schedule.
Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.