Worked solution from the Further Programming Paper 3 Advanced Theory booklet, Part 1 of 2.
An imperative (procedural) language tells the computer how to do a task, step by step.
Write: Programs use variables whose values are changed by assignment statements [1]
Write: The statements are a sequence of commands carried out in the order written, often with repetition (iteration) [1]
A declarative language says what result is wanted, not how to get it.
Write: The programmer states what needs to be done instead of how to do it [1]
Write: It uses facts and rules, and queries to satisfy a goal (it can be logical or functional) [1]
Look at the style of each piece of code:
| Program code example | Programming paradigm |
|---|---|
| male(john). female(ethel). parent(john, ethel). | Declarative |
| FOR Counter = 1 TO 20 ... NEXT Counter | Procedural / imperative |
| Start: LDD Counter, INC ACC, STO Counter | Low-level / assembly |
| public class Vehicle { ... } | Object-oriented (OOP) |
Facts written as male(john). is declarative [1]
A FOR loop with assignment is procedural / imperative [1]
LDD, INC and STO instructions are low-level (assembly language) [1]
A class with private data and a constructor is object-oriented [1]
▶ Topic lesson
A lesson on this topic · by Craig'n'Dave. Tap the picture to open it on YouTube.
Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.