Cambridge A2 Level Computer Science 9618 · 13.1 User-defined data types

Q19 · 9618/31/O/N/25 Q1

Worked solution from the Data Representation Paper 3 Advanced Theory booklet, Part 1 of 3.

Q199618/31/O/N/25original Q1Structured · 6 marks
Question 1 from 9618/31/O/N/25

Worked solution

(a)(i)

Declare a variable whose type is the record type.

DECLARE Member1 : ClubMember

Correct declaration [1]

(a)(ii)

Use the variable name, a dot and the field name. No quotes for a number or TRUE.

Member1.Code ← 984632
Member1.FeesPaid ← TRUE

Code assigned correctly [1]

FeesPaid assigned correctly [1]

(b)(i)

List the activities in brackets.

TYPE Activity = (Badminton, Football, Golf, Snooker, Swimming, Tennis)

TYPE Activity = [1]

All six activities in brackets [1]

(b)(ii)

The new field uses the enumerated type.

DECLARE Choice : Activity

Correct declaration of Choice with type Activity [1]

KEY IDEADeclare a variable of the record type, set fields with variable.field ← value, and use an enumerated type for a fixed list of choices.
TOTAL 6 marks

Official mark scheme

Mark scheme for 9618/31/O/N/25 question 1
VIDEO
▶ Whole paper

Video solution of the whole paper · by Zafar Ali Khan (ZAK). Tap the picture to open it on YouTube.

Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.