← VCE Data Analytics U3O2

Records: grouping fields of different data types

A structure that groups related fields of different data types to describe one thing, such as a student's name (text), age (integer) and mark (decimal).

Understanding Records: grouping fields of different data types in VCE Data Analytics U3O2

What it does: Each student gets their own record with the same fields, showing one record per item. The array stores only integer marks, while the record mixes text (name) and a number (mark) to describe one thing. A field name labels the piece of data (studentName). "Ava Nguyen" is the value stored in that field. Fields in a record can differ in type. This is a key difference between records and arrays. Defining a record means naming every field and giving its data type, such as String, Integer or Float.

Common mistakes: Each field in a record must be declared as fieldName AS Type. The AS keyword is missing, so the line should be ' age AS Integer'. A book title is text, so the field should have the data type String, not Integer. The line should be ' title AS String'. Records can mix data types.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 32–75) and word search (Modules 3–146).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which best describes a record?
Groups related fields, which can be different data types, to describe one thingStores many values that must all be the same data type
Matches
student = {"name": "Noah", "age": "sixteen"} student["age"] + 1
↓
The age field holds text instead of an integer, so maths on it fails. Store it as the integer 16.
Applying
Meanings
Term
record
Meaning
A structure that groups related fields of different data types to describe one thing, such as a student's name (text), age (integer) and mark (decimal).
Practice
RECORD Student
Testing
Gaps
print(["name"])
Check Answer
Spots
2 name AS String
3 age Integer

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Snowy Owl' badge — List Slicer, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which best describes a record?
A. Stores many values that must all be the same data type
B. Groups related fields, which can be different data types, to describe one thing ✓
A record groups related fields of different types (e.g. text, integer, decimal) about one item. An array holds values of the same type.
2. A student record has the fields name, age and mark. Which set of data types fits?
A. name: String, age: Integer, mark: Float ✓
B. name: Integer, age: String, mark: Boolean
Each field gets the type that suits its data: text for name, a whole number for age and a decimal for mark.
3. How many records would you need to store details of 30 students?
A. 1 record that holds all 30 students at once
B. 30 records, one per student ✓
One record describes one item. For 30 students you create one record for each student.
4. Which is a field name in a Student record?
A. studentName ✓
B. "Ava Nguyen"
A field name labels the piece of data (studentName). "Ava Nguyen" is the value stored in that field.
5. Record or array: you want to store a student's name, age and mark together.
A. Record ✓
B. Array
The data is about one thing and mixes data types (text, integer, decimal), so a record is the best fit.

Match the Pairs

student = {"name": "Ava", "age": 15, "mark": 88.5} → A record for one student that groups a text field, an integer field and a decimal field
Record Student: name String, age Integer, mark Float → A record definition that lists each field name and its data type
A record holds one item, so you need one record per student → student1 = {"name": "Ava", "age": 15} student2 = {"name": "Liam", "age": 16}
An array holds values of the same type, but a record can mix data types → marks = [88, 74, 91] student = {"name": "Mia", "mark": 91}
student = {"name": "Noah", "age": "sixteen"} student["age"] + 1 → The age field holds text instead of an integer, so maths on it fails. Store it as the integer 16.
students = {"name": "Zoe", "name": "Leo", "age": 15} → Two students are crammed into one record by repeating a field. Each student needs their own record.

Key Term

record
A structure that groups related fields of different data types to describe one thing, such as a student's name (text), age (integer) and mark (decimal).

Fill in the Blanks

1. student = {"name": "Ava", "age": 15} print(student["name"])
Hint: Type the variable name that holds the record, so you can read its name field
2. student = {"name": "Ava", "mark": 87.5} print(type(student["mark"]))
Hint: Type the built-in function that reports the data type of a value
3. roster = [{"name": "Zoe"}, {"name": "Leo"}] print(roster[1]["name"])
Hint: Type the index of the second record in the list, remembering that indexes start at zero
4. student = {"name": "Ava", "age": 15} print(len(student))
Hint: Type the built-in function that counts how many fields the record holds
5. student = {"name": "Ava", "age": 15} for field in student: print(field)
Hint: Type the keyword that starts a loop through every field name in the record

Spot the Error

Question 1
A RECORD Student
B name AS String
C age Integer
D mark AS Decimal
E END RECORD
Line C — Each field in a record must be declared as fieldName AS Type. The AS keyword is missing, so the line should be ' age AS Integer'.
Question 2
A RECORD Book
B title AS Integer
C pages AS Integer
D END RECORD
Line B — A book title is text, so the field should have the data type String, not Integer. The line should be ' title AS String'. Records can mix data types.
Question 3
A DIM s AS Student
B s.name = "Ava"
C s.age = "16"
D s.mark = 88.5
Line C — The age field is an Integer, so it must be given a whole number, not text in quotes. The line should be 's.age = 16'.
Question 4
A ARRAY Pet
B name AS String
C age AS Integer
D END RECORD
Line A — An array holds items of the same data type, but this structure has a String and an Integer field. A record groups different types, so the line should be 'RECORD Pet'.
Question 5
A DIM s AS Student
B s.name = Noah
C s.mark = 72.5
Line B — A String value must be written inside quotes. Without them, Noah looks like a variable name. The line should be 's.name = "Noah"'.

Student with a class code? Join your class →