Record Structures (Cambridge (CIE) A Level Computer Science): Revision Note

Exam code: 9618

Robert Hampton

Written by: Robert Hampton

Reviewed by: James Woodhouse

Updated on

Purpose of records

What is a record?

  • A record is a composite data structure used to store a collection of related data items

  • Each item can be of a different data type

  • It allows a programmer to group related values under one identifier

  • Records help create a more structured and readable approach to storing and managing data

  • A record contains a fixed number of fields, each with its own name and type

  • In pseudocode, a record can by declared as:

TYPE <Typename>
    DECLARE <identifier> : <data type>
    DECLARE <identifier> : <data type>
    DECLARE <identifier> : <data type>
    ..
    ..
ENDTYPE
  • Suppose we want to store information about a car

  • We can define a record type like this:

TYPE Car
    DECLARE Make : STRING
    DECLARE Model : STRING
    DECLARE Colour : STRING
    DECLARE Price : REAL
    DECLARE DateOfRegistration : DATE
ENDTYPE
  • We can then create a variable of this type:

DECLARE MyCar : Car
  • And assign values to its fields:

MyCar.Make ← "Toyota"
MyCar.Model ← "Yaris"
MyCar.Colour ← "Red"
MyCar.Price ← 14995.99
MyCar.DateOfRegistration ← "12/03/2022"
  • To read from the record we can:

OUTPUT "Make: ", MyCar.Make
OUTPUT "Model: ", MyCar.Model
OUTPUT "Colour: ", MyCar.Colour
OUTPUT "Price: £", MyCar.Price
OUTPUT "Date of Registration: ", MyCar.DateOfRegistration

Examiner Tips and Tricks

  • Records in programming are a type of data structure used to group related data in your code

  • These are not the same as records in a database, which refer to a complete set of fields on a single entity in a table (row)

Key features of records

Feature

Explanation

Can store different data types

Unlike arrays, records are not limited to a single type

Fields are named

Each item in the record has a meaningful identifier

Offers structured storage

Easier to manage complex data about real-world entities

You've read 0 of your 5 free revision notes this week

Unlock more, it's free!

Join the 100,000+ Students that ❤️ Save My Exams

the (exam) results speak for themselves:

Did this page help you?

Robert Hampton

Author: Robert Hampton

Expertise: Computer Science Content Creator

Rob has over 16 years' experience teaching Computer Science and ICT at KS3 & GCSE levels. Rob has demonstrated strong leadership as Head of Department since 2012 and previously supported teacher development as a Specialist Leader of Education, empowering departments to excel in Computer Science. Beyond his tech expertise, Robert embraces the virtual world as an avid gamer, conquering digital battlefields when he's not coding.

James Woodhouse

Reviewer: James Woodhouse

Expertise: Computer Science & English Subject Lead

James graduated from the University of Sunderland with a degree in ICT and Computing education. He has over 14 years of experience both teaching and leading in Computer Science, specialising in teaching GCSE and A-level. James has held various leadership roles, including Head of Computer Science and coordinator positions for Key Stage 3 and Key Stage 4. James has a keen interest in networking security and technologies aimed at preventing security breaches.