Programming Fundamentals
Aligned to the AQA 7517 specification
- Level
- Intermediate
- Reading time
- 7 min
- Published
- 13 June 2026
- Updated
- 1 July 2026
On this page
Key takeaways
- Every value has a data type that determines how it is represented in memory and which operations are valid; AQA types include integer, real, Boolean, character, string, date/time, pointer/reference and record.
- Real division `/` gives a real result (`7 / 2` = `3.5`), while integer division `DIV` discards the fraction (`7 DIV 2` = `3`) and `MOD` gives the remainder (`7 MOD 2` = `1`).
- AQA pseudocode uses 1-based string indexing, so the first character is at position 1, and `SUBSTRING("Hello", 1, 3)` returns `"Hel"`.
- A TRY block holds code that might fail; if an exception occurs control jumps to the EXCEPT block, and execution continues after ENDTRY.
- `RANDOM_INT(a, b)` returns a random integer in the range a to b inclusive, so both endpoints can occur.
Worth saving these ideas?
Turn what you've read into instant revision cards. Free to get started.
Key terms
- Data type
- A classification of a value that determines how it is represented in memory and what operations are valid on it.
- Variable
- A named store for a value that can change during program execution.
- Constant
- A named store for a fixed value defined once and not reassigned, making code easier to read and safer to maintain.
- Arithmetic operator
- An operator that produces a numeric result, such as `+`, `-`, `*`, `/`, `DIV`, `MOD` and `^`.
- Comparison operator
- An operator that produces a Boolean result, such as `<`, `<=`, `>`, `>=`, `=` and `≠`.
- Boolean operator
- An operator that combines or negates Boolean values: `NOT`, `AND`, `OR`, `XOR`.
- Operator precedence
- The order operators are evaluated: exponentiation, then `*`, `/`, `DIV`, `MOD`, then `+`, `-`, then comparisons, with brackets used to override.
- Type casting
- Converting a value from one data type to another, for example `INT("17")` converting a string to an integer.
- Exception
- An error condition that occurs at runtime, such as dividing by zero or reading beyond the end of a file, which crashes the program if unhandled.
- RANDOM_INT(a, b)
- A pseudocode function returning a random integer in the range a to b inclusive of both endpoints.
- DIV
- The integer division operator, which divides and discards any fractional part, so `7 DIV 2` is `3`.
- MOD
- The remainder operator, which gives the remainder after division, so `7 MOD 2` is `1`.
Frequently asked questions
`/` is real division and keeps the fractional part, so `7 / 2` gives `3.5`. `DIV` is integer division and discards the fraction, so `7 DIV 2` gives `3`. Forgetting `DIV` causes type errors when an integer is required.
AQA pseudocode uses 1-based indexing, so the first character is at position 1, not 0. For example `SUBSTRING("Hello", 1, 3)` returns `"Hel"`. Python uses 0-based indexing, so take care when translating between the two.
The TRY block contains code that might fail at runtime. If an exception such as division by zero or invalid type conversion occurs, control jumps to the EXCEPT block, and execution continues after ENDTRY. Handling should catch specific anticipated errors rather than suppress all errors.
Generate revision on any topic you study
Type any topic you're studying and Aicademy generates a complete lesson, quiz, and flashcard set, personalised to your level.
Lessons on anything
Structured, level-matched lessons on any topic you study
Practice quizzes
Find out what you actually know before the exam does
Flashcard sets
Lock in key concepts with instant revision cards
Ask Aica
Stuck on something? Get a clear explanation, any time
Subroutines and Recursion
Related lessons
6 min
6 min