9618/31/O/N/24 question 6: worked solution (October/November 2024, paper 31)

Show as 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. Q14 9618/31/O/N/24 original Q6 Structured · 7 marks Worked solution (a) Any three of these: A set is a composite user-defined data type. [1] It holds a list of unordered elements. [1] Set operations such as union and intersection can be applied to its elements. [1] Its definition includes the data type it uses. (also credited, but no extra mark: any n only) All the elements are of the same data type. (also credited, but no extra mark: any n only) (b) TYPE SymbolSet = SET OF CHAR DEFINE Operators ('+', '-', '*', '/', '^') : SymbolSet Any four of these: TYPE SymbolSet = [1] SET OF CHAR [1] DEFINE Operators [1] The five operators in brackets [1] : SymbolSet after the list (also credited, but no extra mark: any n only) The type and the variable may swap names (TYPE Operators = SET OF CHAR, then DEFINE SymbolSet) and still score. KEY IDEA Declare a set type with TYPE ... = SET OF, then DEFINE the variable with its values and type. TOTAL 7 marks Official mark scheme VIDEO ▶ Topic lesson A lesson on this topic · by ZAINEMATICS. Tap the picture to open it on YouTube.