9618/32/O/N/24 question 3: worked solution (October/November 2024, paper 32)
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. Q15 9618/32/O/N/24 original Q3 Structured · 7 marks Worked solution (a) A record lets you group several related items under one name. Write any three of these: A record is a composite data type [1] It is made up of other data types, which form one new data type [1] The items can be primitive types (such as INTEGER or STRING) or other user-defined types [1] Other points that score: it holds related items , and it has a fixed number of items (fields). (b) Start with TYPE and the name, DECLARE each field with its data type, and finish with ENDTYPE. TYPE Order DECLARE AccountNumber : INTEGER DECLARE OrderNumber : INTEGER DECLARE OrderPrice : REAL DECLARE OrderDate : DATE ENDTYPE TYPE Order and ENDTYPE correct [1] DECLARE used correctly for every field [1] Account number and order number given an integer type [1] Order price as REAL and order date as DATE [1] KEY IDEA A record groups related fields of different types in a TYPE ... ENDTYPE block, with DECLARE for each field. TOTAL 7 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by Zafar Ali Khan (ZAK). Tap the picture to open it on YouTube.