9618/31/O/N/22 question 3: worked solution (October/November 2022, paper 31)
Show as plain textHide plain text
Cambridge A2 Level Computer Science 9618 · 13.1 User-defined data types Worked solution from the Data Representation Paper 3 Advanced Theory booklet, Part 1 of 3. Q5 9618/31/O/N/22 original Q3 Structured · 8 marks 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 IDEA Strings go in double quotes, chars in single quotes, and numbers have no quotes. TOTAL 8 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by MAK CS. Tap the picture to open it on YouTube.