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

Q5 · 9618/31/O/N/22 Q3

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

Q59618/31/O/N/22original Q3Structured · 8 marks
Question 3 from 9618/31/O/N/22

Worked solution

(a)

An enumerated data type is a user-defined (non-composite) type with an ordered list of possible values [1]

(b)

A pointer data type is a user-defined (non-composite) type used to reference a memory location [1]

(c)

TYPE Quarter1 = (January, February, March)

TYPE Quarter1 = [1]

(January, February, March) [1]

(d)(i)

DECLARE Pet1 : Pet

Variable declared with the type Pet [1]

(d)(ii)

Pet1.PetName ← "Tibbles"
Pet1.AnimalType ← "Cat"
Pet1.PetAge ← 8
Pet1.PetGender ← 'M'
Pet1.OwnerName ← "Jasmine Smith"

All three string values (PetName, AnimalType, OwnerName) assigned in quotes [1]

Char value 'M' assigned in single quotes [1]

Integer 8 assigned with no quotes [1]

KEY IDEAStrings go in double quotes, chars in single quotes, and numbers have no quotes.
TOTAL 8 marks

Official mark scheme

Mark scheme for 9618/31/O/N/22 question 3
VIDEO
▶ Whole paper

Video solution of the whole paper · by MAK CS. 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.