What are the built-in data types and how is data stored in memory?
Understand the built-in data types: integer, real or float, Boolean, character and string, and understand records, arrays and user-defined data types built from them.
A focused answer to AQA A-Level Computer Science 4.1.1, covering the built-in data types (integer, real, Boolean, character, string), how each is stored, and how records, arrays and user-defined types are built from them.
Reviewed by: AI editorial process; not yet individually human-reviewed
Have a quick question? Jump to the Q&A page
Jump to a section
What this dot point is asking
AQA wants you to name and describe the built-in data types (integer, real or float, Boolean, character and string), say what each stores and how much memory it typically uses, and explain how composite and user-defined types (records and arrays) are built from these primitives.
The built-in data types
- Integer: a whole number with no fractional part, for example
42or-7. Stored in pure binary (unsigned) or two's complement (signed), typically in 16, 32 or 64 bits. - Real or float: a number that may have a fractional part, for example
3.14. Stored in floating point as a mantissa and an exponent. - Boolean: one of two logical values,
TrueorFalse. Needs only a single bit, though languages often store it in a whole byte for addressing convenience. - Character: a single symbol such as
'A','7'or'?'. Stored as a numeric code using a character set such as ASCII or Unicode. - String: an ordered sequence of characters, for example
"hello". Stored as the characters in order, often with a length count or an end marker.
These primitive types connect directly to the data representation topic: an integer is exactly the binary representation studied in 4.5, a real is floating point, and a character is an ASCII or Unicode code. The data type is therefore not just a label; it tells the compiler how to interpret the bits in memory, so the same bit pattern means a different value as an integer, a real or a character.
Composite and user-defined types
User-defined types matter because they let the program speak the language of the problem rather than of raw primitives. Defining a Date record with day, month and year fields, or an enumerated Suit type with the values hearts, diamonds, clubs and spades, makes code more readable and lets the type system reject impossible values. This is closely related to abstraction: a well-chosen type hides irrelevant detail and exposes only the meaningful operations.
Choosing the right type
Using the correct type saves memory and prevents errors. Storing an age as a Boolean would lose information; storing a price as an integer would lose the pence; using a 64-bit integer where an 8-bit one suffices wastes memory across millions of records. A type also restricts operations: you can add two integers, but adding two Booleans is meaningless, so the type system catches the mistake at compile time rather than letting it corrupt results at run time. This is why selecting types thoughtfully is treated as a genuine design skill, not a formality.
Exam-style practice questions
Practice questions written in the style of AQA exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.
AQA 20184 marksFor each of the following items of data, state the most appropriate built-in data type and justify your choice: (a) a person's surname, (b) the price of an item in pounds and pence, (c) whether an account is active, (d) a single grade letter.Show worked answer →
(a) Surname: string, because it is a sequence of characters of variable length. (b) Price: real or float, because it has a fractional part (pounds and pence), so an integer would lose the pence. (c) Account active: Boolean, because there are exactly two states, active or not. (d) Grade letter: character, because it is a single symbol such as 'A'.
Markers reward each correct type with a justification tied to the nature of the data (sequence of characters, fractional value, two states, single symbol). Naming the type without a reason earns only partial credit on a question that asks you to justify.
AQA 20213 marksExplain the difference between a record and an array, and describe a situation in which a record is the more appropriate choice.Show worked answer →
An array holds many items of the same data type, accessed by a numeric index, so it suits a list of like values such as 30 test marks. A record groups several fields of possibly different types under one name, accessed by field name, so it suits a single entity made of mixed attributes.
A record is more appropriate when storing the details of one entity that has attributes of different types, for example a student with a name (string), age (integer) and enrolled flag (Boolean): a single array could not hold those three different types together, whereas a record keeps them as one logical unit.
Markers reward the same-type-by-index versus mixed-types-by-name distinction and a valid scenario where a record fits.
Related dot points
- Understand and use the three basic programming constructs (sequence, selection and iteration), definite and indefinite iteration, nested constructs, and the meaning of constants and variables.
A focused answer to AQA A-Level Computer Science 4.1.2, covering the three basic constructs sequence, selection and iteration, definite and indefinite iteration, nesting, and the difference between constants and variables.
- Use arithmetic operations including integer division, modulus and exponentiation, relational operators, and the Boolean operators AND, OR and NOT, and understand operator precedence.
A focused answer to AQA A-Level Computer Science 4.1.3, covering arithmetic operators including integer division and modulus, relational operators, the Boolean operators AND, OR and NOT, and operator precedence.
- Understand and use subroutines (procedures and functions), parameters, return values, local and global variables, scope, and the use of an interface and recursion.
A focused answer to AQA A-Level Computer Science 4.1.4 and 4.1.6, covering procedures and functions, parameters and return values, local and global scope, the benefits of subroutines, and recursion.
- Understand classes and objects, attributes and methods, instantiation, encapsulation, inheritance and polymorphism, and the principle of object-oriented design.
A focused answer to AQA A-Level Computer Science 4.1.5, covering classes and objects, attributes and methods, instantiation, encapsulation, inheritance and polymorphism, and the benefits of object-oriented design.
- Understand unsigned and signed binary using two's complement, binary addition and subtraction, fixed point and floating point representation of real numbers, and the effects of overflow and rounding.
A focused answer to AQA A-Level Computer Science 4.5.2 to 4.5.7, covering unsigned and signed binary using two's complement, binary addition and subtraction, fixed and floating point representation of real numbers, and overflow and rounding errors.
Sources & how we know this
- AQA A-level Computer Science (7517) specification — AQA (2015)