Records in pseudocode

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Records in pseudocode

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Does a record group different fields under one name?
A No
B Yes
2. Is dot notation used to access a record's field?
A Yes
B No
3. Is car.brand = "Ford" the correct way to assign a value?
A No
B Yes
4. Are record field names case-sensitive in pseudocode?
A No
B Yes
5. Can a record store fields of different data types together?
A Yes
B No

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1student.name ADeclares a new record called book
2DECLARE book OF RECORD Bstudent.age
3Groups related fields under one record name CWrong - use ← for assignment, not =
4Connects a record name to one of its fields DDECLARE car OF RECORD
5student.name = "Sam" EWrong - use a dot (.) to access a field, not a colon
6DISPLAY student:name FAccesses the name field of the student record

Definitions

student.name

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
student.____ ← "Sam"
2.
DISPLAY student.____
3.
student.age ← __
4.
DECLARE student OF ______
5.
book._____ ← "Dune"

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A RECORD student HAS name
B DECLARE student OF RECORD
C student.name ← "Sam"
Question 2
A DECLARE student OF RECORD
B student.name = "Sam"
C student.age ← 15
Question 3
A DECLARE student OF RECORD
B student.name ← "Sam"
C DISPLAY student:name
Question 4
A DECLARE student OF RECORD
B student.name ← "Sam"
C student.age ← 15
D DISPLAY student.naem
Question 5
A DECLARE book OF RECORD
B book.title ← "Dune"
C book.pages ← 412
D DISPLAY book.title
E DISPLAY book.Pages

Answer Key

Records in pseudocode
Section A: Quick Questions
Q1
B — Yes
Q2
A — Yes
Q3
A — No
Q4
B — Yes
Q5
A — Yes
Section B: Match the Pairs
Q1
student.name → Accesses the name field of the student record
Q2
DECLARE book OF RECORD → Declares a new record called book
Q3
Groups related fields under one record name → DECLARE car OF RECORD
Q4
Connects a record name to one of its fields → student.age
Q5
student.name = "Sam" → Wrong - use ← for assignment, not =
Q6
DISPLAY student:name → Wrong - use a dot (.) to access a field, not a colon
Section C: Definitions
Q1
student.name — Accesses the name field of the student record, using a dot to connect the record to its field.
Section D: Fill in the Blanks
Q1
student.name ← "Sam"
Q2
DISPLAY student.name
Q3
student.age ← 15
Q4
DECLARE student OF RECORD
Q5
book.title ← "Dune"
Section E: Spot the Error
Q1
A — A record isn't declared this way - use DECLARE ... OF RECORD.
Q2
B — Field assignment uses ←, not =, in pseudocode.
Q3
C — Fields are accessed with a dot, not a colon.
Q4
D — The field name is misspelled - it should be 'name', not 'naem'.
Q5
E — Field names are case-sensitive - it should be 'pages', not 'Pages'.