Skip to main content
EnglandComputer ScienceSyllabus dot point

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.

Generated by Claude Opus 4.88 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. The built-in data types
  3. Composite and user-defined types
  4. Choosing the right type

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 42 or -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, True or False. 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

Sources & how we know this