In simple terms
A friendly intro before the formal notes — no formulas yet.
Building with Data Blocks
Data types are the basic building blocks of programming, like different kinds of Lego bricks. A record is a custom structure you build by combining these different bricks to represent a more complex object.
Think of a person's contact details on your phone. The entire contact is a single 'record'. This record is made up of smaller, different pieces of information: a name (text), a phone number (which we'd store as text), an age (a number), and perhaps a 'favourite' status (a true/false toggle). Each piece has its own specific 'type', and the record groups them all together under one name.
- 1
Identify the individual pieces of data needed to represent a real-world object, like a 'Book'.
- 2
For each piece, choose the most suitable basic data type (e.g., String for the title, Integer for the year).
- 3
Define a new 'record' type that groups these fields and their chosen data types together under a single name, like 'TBook'.
- 4
Declare variables of this new record type to create and manage specific instances, such as 'ThisBook' or an array of books.
Explore the concept
Use the live diagram and synced steps — play it or tap a step card to walk through.
Key formulas
Tap any symbol to reveal exactly what it means and its units.
Full topic notes
Formal explanation with the rigour you need for the exam.
Primitive Data Types: The Basics
Think of primitive data types as the atoms of information in your program. They are the simplest, most fundamental units provided by a programming language. Every piece of data, from a user's age to the price of an item, must be assigned a type so the computer knows how to store it and what operations are permissible.
INTEGER: Whole numbers, e.g., 10, -5, 2024.
REAL: Numbers with a decimal part, e.g., 19.99, 3.14159, -0.5.
CHAR: A single character, e.g., 'A', '%', '5'. Note the single quotes.
STRING: A sequence of characters, e.g., "Cambridge", "Computer Science 9618". Note the double quotes.
BOOLEAN: Logical values, can only be TRUE or FALSE.
Examiners will often test your ability to choose the most appropriate data type. Ask yourself: Will I perform calculations on this number? Does it need to store a leading zero? For example, a student ID like '00123' should be a STRING, not an INTEGER, to preserve the leading zeros.
Composite Data Types: Introducing the Record
Often, we need to handle data that is more complex than a single number or string. A 'student', for example, has a name, an ID number, and several grades. Instead of juggling many separate variables (StudentName, StudentID, StudentGrade), we can group them into a single, logical unit called a record. A record is a composite data type you define yourself.
TYPE TStudent = RECORD Name : STRING StudentID : INTEGER DateOfBirth : DATE IsFeePaid : BOOLEAN ENDRECORD
In this Cambridge-style pseudocode, we use the TYPE keyword to define a new data type called TStudent. This new type acts as a template, containing fields like Name and StudentID, each with its own primitive data type. The prefix is a common convention to denote a 'Type', which improves code readability.
Declaring and Using Record Variables
Defining a record type with TYPE is like creating a blueprint. To actually store data, you need to build an object from that blueprint. This is done by declaring a variable of your new record type using the DECLARE keyword. Once you have a record variable, you can access its individual fields using dot notation (.).
// To declare a single record variable DECLARE MyBook : TBook
// To assign a value to a field MyBook.Title <- "The Pragmatic Programmer" MyBook.Price <- 25.50
// To access and output a field's value OUTPUT MyBook.Author
Worked examples
See the formulas applied — reveal one step at a time, like the exam.
A library system needs to store details for each book. A book has a title, author, ISBN (International Standard Book Number), price, and publication year. Define a suitable record type in pseudocode to represent a book.
- 1
First, we identify the fields and their most appropriate data types:
- Title: Sequence of characters -> STRING
- Author: Sequence of characters -> STRING
- ISBN: Contains digits and sometimes hyphens, no calculations -> STRING
- Price: Number with a decimal part -> REAL
- PublicationYear: Whole number -> INTEGER
A car dealership uses a system to manage its stock. A TCar record type has been defined as follows:
TYPE TCar = RECORD
Make : STRING
Model : STRING
Registration : STRING
Year : INTEGER
Price : REAL
ENDRECORD
- Declare an array named CarStock that can hold 50 cars.
- Write the pseudocode to set the price of the 10th car in the array to 15000.00.
- 1
To declare an array of records, we specify the array bounds and the record type.
How it all connects
The big idea sits in the middle — tap a linked idea to explore the link.
Tap a linked idea to see how it connects back to the main topic — that connection is what examiners reward.
Glossary
Try to recall each definition before you reveal it.
Quick check
Answer in your head first — then tap to check. No pressure.
Revision flashcards
Flip the card. Test yourself before the exam.
What is a data type?
A classification that specifies which type of value a variable can hold and what type of operations can be applied to it without causing an error. For example, INTEGER, REAL, STRING.
Key takeaways
Review these before you close the topic — retrieval beats re-reading.
- ✓
INTEGER: Whole numbers, e.g., 10, -5, 2024.
- ✓
REAL: Numbers with a decimal part, e.g., 19.99, 3.14159, -0.5.
- ✓
CHAR: A single character, e.g., 'A', '%', '5'. Note the single quotes.
- ✓
STRING: A sequence of characters, e.g., "Cambridge", "Computer Science 9618". Note the double quotes.
- ✓
BOOLEAN: Logical values, can only be TRUE or FALSE.
Practice — then mark it
The whole point: a real Cambridge question, marked mark-by-mark.
Practice Data Types & Records
Practice Data Types & Records
Extra simulations & links
PhET, GeoGebra and other curated tools — open in a new tab.
Frequently asked
Checkpoint
One marked question is worth ten re-reads — close the loop before you move on.
Reading it isn’t knowing it — prove it.
Before you move on: do Practice Data Types & Records on paper, snap a photo, and get examiner-style feedback on exactly where you win and lose marks.