In simple terms
A friendly intro before the formal notes — no formulas yet.
Build Your Own Data Blueprints
Instead of just using basic data types like INTEGER or STRING, we can create our own custom data types to group related information together. This makes our code much cleaner, more logical, and easier to understand, just like organising files into a specific folder.
Think of a library card. The card itself is a single object, but it holds different pieces of information: a person's name (a string), a member ID (an integer), and an expiry date (a date). A user-defined data type lets us create a 'LibraryCard' blueprint in our code, specifying that it must contain these three distinct fields. We can then create many individual cards from this single blueprint.
- 1
Identify related data items you want to group, like a student's name, ID, and date of birth.
- 2
Define a new composite data type using the TYPE and ENDTYPE keywords, listing each field and its base data type.
- 3
Declare a variable of your new custom type, just as you would declare an integer or string variable.
- 4
Access and manipulate the individual fields within the variable using dot notation, for example MyStudent.Name.
Explore the concept
Use the live diagram and synced steps — play it or tap a step card to walk through.
Full topic notes
Formal explanation with the rigour you need for the exam.
Composite Data Types: The Record
The most common user-defined type you will encounter in the A-Level syllabus is the composite data type, specifically the record. A record is a collection of related data items, called fields, which are grouped together under a single name. A key feature of a record is that its fields can be of different data types.
A record is a composite data type.
It groups multiple variables (fields) into a single unit.
Fields can have different data types (e.g., a mix of STRING, INTEGER, DATE).
This allows us to model real-world objects like a student, a car, or a product.
Defining a Record in Pseudocode
To create a record, we must first define its structure, or 'blueprint'. We use the TYPE and ENDTYPE keywords for this. Inside the definition, we list each field's identifier and its corresponding data type.
TYPE <TypeName> DECLARE <FieldName1> : <DataType1> DECLARE <FieldName2> : <DataType2> ... ENDTYPE
Declaring and Using Record Variables
Once a type has been defined, it acts like any other data type. We can DECLARE variables of this new type. To access the individual fields within a record variable, we use dot notation. The syntax is VariableName.FieldName.
Other User-Defined Types
While records are the most common, the syllabus also includes other user-defined types. An enumerated type defines a new type and a list of all possible values (named constants) it can hold. For example, . A pointer type is a type that stores a memory address. This is fundamental for creating dynamic data structures like linked lists and binary trees, which you will study in more detail later. For example, defines a pointer to a record of type TNode.
Worked examples
See the formulas applied — reveal one step at a time, like the exam.
A bookshop needs to store information about each book: its ISBN (13-digit string), title, author, and price. Define a suitable user-defined data type called TBook.
- 1
Here is the pseudocode definition for the TBook type:
Using the TBook type defined previously:
- Declare a variable newBook of type TBook.
- Write pseudocode to assign the value "978-0-241-98276-1" to its ISBN field and 9.99 to its Price field.
- Write a statement to output the price of newBook.
- 1
Declaration:
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 user-defined data type?
A data type that is defined by the programmer, rather than being a built-in (primitive) type. It is derived from existing data types.
Key takeaways
Review these before you close the topic — retrieval beats re-reading.
- ✓
A record is a composite data type.
- ✓
It groups multiple variables (fields) into a single unit.
- ✓
Fields can have different data types (e.g., a mix of STRING, INTEGER, DATE).
- ✓
This allows us to model real-world objects like a student, a car, or a product.
Practice — then mark it
The whole point: a real Cambridge question, marked mark-by-mark.
Practice Questions: User-Defined Data Types
Practice Questions: User-Defined Data Types
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 Questions: User-Defined Data Types on paper, snap a photo, and get examiner-style feedback on exactly where you win and lose marks.