A data type determines what kind of value a variable can hold and what operations can be performed on it. AQA 7517 requires knowledge of the following data types:
| Data Type | Description | Example |
|---|---|---|
| Integer | Whole number, positive or negative, no fractional part | 42, -17, 0 |
| Real/Float | Number with a fractional (decimal) part | 3.14, -0.5, 2.0 |
| Boolean | Logical value — either True or False only | True, False |
| Character | A single symbol from the character set | 'A', '7', '!' |
| String | A sequence of zero or more characters | "Hello", "CS Zone" |
| Date/Time | Represents a date and/or time value | 2024-09-01, 14:30:00 |
A record (or struct in some languages) groups together related items of data that may be of different types under one identifier.
Example — a student record might contain: name (String), age (Integer), isEnrolled (Boolean), grade (Real)
An array is an ordered, indexed collection of elements all of the same data type. In AQA A-Level, 1D and 2D arrays are examinable:
scores[0..4] holds 5 integers indexed 0–4grid[0..2, 0..2] represents a 3×3 matrixAQA 7517 requires you to understand that programmers can define their own data types based on the built-in (language-defined) types. This allows modelling of real-world entities more accurately.
A variable is a named memory location whose value can change during program execution. Variables must be:
← in AQA pseudocode, = in Python)DECLARE score : INTEGER — declares a variable named score of type INTEGER
score ← 85 — assigns the value 85 to score
Local variables are declared inside a subroutine and only exist while that subroutine is executing. They cannot be accessed from outside.
Global variables are declared outside all subroutines and can be accessed from anywhere in the program. They persist for the entire lifetime of the program.
| Feature | Local Variable | Global Variable |
|---|---|---|
| Declared in | Inside a subroutine | Outside all subroutines |
| Accessible from | Only within that subroutine | Anywhere in the program |
| Lifetime | Only while subroutine runs | Whole program execution |
| Preferred? | ✓ Yes — avoids side effects | Use sparingly — risk of unintended changes |
A constant is a named value that cannot be changed during program execution. Once defined, its value is fixed.
In AQA pseudocode: CONSTANT PI ← 3.14159
In Python: by convention, PI = 3.14159 (all caps signals a constant, though Python doesn't enforce immutability)
TAX_RATE is clearer than 0.20 scattered through codecharacter (single symbol) with string (sequence of characters) — 'A' is a character, "A" is a string of length 18 questions · instantly marked · AQA 7517 standard
CONSTANT VAT_RATE ← 0.2DECLARE grid : ARRAY[0..2, 0..2] OF INTEGER. State the dimensions of this array and explain what grid[1,2] refers to.[2]| Term | Definition |
|---|
10 questions · 10 marks · 10 minutes