This mini-lesson covers the whole of AQA 4.1 — Fundamentals of programming. It is the bedrock of Paper 1: everything you write in the exam's Skeleton Program leans on it.
Work through each screen, answer the questions as you go (some are recall, some are calculations you must actually work out) and collect ⭐ stars. Press Start when you're ready.
A data type tells the compiler two things: what values a variable may hold, and what operations are legal on it. AQA expects you to know these:
| Type | Holds | Typical size |
|---|---|---|
| integer | whole numbers, positive or negative | 2 or 4 bytes |
| real / float | numbers with a fractional part | 4 or 8 bytes |
| Boolean | True or False only | 1 bit (usually padded to 1 byte) |
| character | a single symbol, e.g. 'A' | 1 byte (ASCII) / 1–4 (Unicode) |
| string | a sequence of characters | varies |
| date/time | a point in time | varies |
| pointer / reference | a memory address | 4 or 8 bytes |
| record | fields of mixed type grouped together | sum of its fields |
Why it matters: choosing integer over real where you can is not fussiness — integers are exact, while reals are stored in floating point and carry rounding error. Money is best held as an integer number of pence.
Three constructs are enough to express any computable algorithm (this is the structure theorem): sequence, selection and iteration.
Two arithmetic operators that catch people out:
Classic use: MOD 2 = 0 tests for even. MOD also wraps a value round a circular buffer, and DIV/MOD together split a total of seconds into minutes and seconds.
total as an integer. Which single line is guaranteed to leave an integer result in every language AQA supports?A subroutine is a named block of code that can be called from elsewhere. AQA distinguishes:
Values passed in are parameters (in the definition) and arguments (at the call). There are two ways to pass them:
| By value | By reference |
|---|---|
| A copy of the value is passed. | The memory address of the variable is passed. |
| Changes inside the subroutine are lost on return. | Changes inside the subroutine persist in the caller. |
| Safer; costs time and memory for large data. | Efficient for large arrays; risks unintended side effects. |
Watch out: in Python and Java, objects and lists are passed by object reference — mutating the list inside a function does change the caller's list, even though reassigning the name does not.
Scope is the region of a program in which an identifier is visible.
Locals are preferred because they:
Shadowing: if a local has the same name as a global, the local wins inside that subroutine — the global is hidden, not overwritten.
A subroutine is recursive if it calls itself. Every valid recursive routine needs:
Each call pushes a stack frame onto the call stack holding the return address, the parameters and the locals. The frames unwind in reverse (last in, first out) as each call returns.
Trade-off: recursion is elegant for problems with a naturally recursive structure (tree traversal, quicksort, merge sort, Towers of Hanoi) but uses more memory than iteration and is slower because of the call overhead. Any recursive routine can be rewritten iteratively, using an explicit stack if necessary.
A class is a blueprint: it defines the attributes (data) and methods (behaviour) that its instances will have. An object is an instance of a class, created by instantiation — the constructor runs and sets the initial state.
Encapsulation (information hiding) means attributes are declared private and can only be read or changed through public methods (getters and setters).
Because balance is private, no outside code can set it to a negative number: the class enforces its own invariants. The internal representation can also be changed later without breaking any code that uses the class.
Inheritance: a subclass derives from a superclass, gaining its attributes and methods and adding or changing its own. It models an is-a relationship — a Savings account is a kind of Account.
Overriding: the subclass supplies its own version of an inherited method with the same signature.
Polymorphism: one interface, many forms. The same call on different objects runs different code, chosen at run time by the object's actual class.
Composition (has-a) is the alternative to inheritance: a Car has an Engine. The maxim "favour composition over inheritance" exists because deep inheritance hierarchies are brittle — a change high up breaks everything below.
Abstraction in OOP: the public interface tells you what an object does; the private implementation hides how. You can drive a car without knowing how the engine works.
Circle, Square and Triangle objects, all subclasses of Shape. The program loops through the list calling s.Area() on each. Which OOP feature makes the correct version of Area() run for each object?Temperature class stores celsius as a private attribute with a public SetCelsius() method that rejects values below −273.15. What does the private declaration achieve?An exception is a run-time error — a fault that only appears when the program actually runs (not a syntax error, which the translator catches first).
A try / except (catch) block lets the program recover instead of crashing:
Exam point: exception handling makes a program robust — it copes with invalid input and unexpected conditions gracefully rather than terminating. Do not use a bare catch-everything block that silently swallows errors: a bug you never see is worse than one that crashes.
Tap a term, then tap the group it belongs to.
Tap an item on the left, then its partner on the right.
Data types: integer · real · Boolean · character · string · date/time · pointer/reference · record
Operators: DIV = integer quotient, MOD = remainder, / = real division
Subroutines: procedure (no return) vs function (returns one value); by value = copy, by reference = address
Scope: local = created on call, destroyed on return; global = visible everywhere (avoid)
Recursion: base case + general case + progress towards the base case; each call adds a stack frame
OOP: class = blueprint, object = instance; encapsulation · inheritance (is-a) · polymorphism (overriding) · composition (has-a)
Exceptions: try / except / finally handles run-time errors so the program stays robust
That is the whole of AQA 4.1. Press Finish to see your score.
You've worked through Fundamentals of programming for AQA A-level Computer Science (7517). 🎉
Your stars: 0 / 0
Next: test yourself in the Evaluate stage Confidence Quiz, then lock it in with Verify.