9618/21/M/J/23 question 3: worked solution (May/June 2023, paper 21)
Show as plain textHide plain text
Cambridge AS Level Computer Science 9618 · 10.1 Data Types and Records Worked solution from the Data Types and Structures Paper 2 Problem-solving and Programming booklet, Part 1 of 4. Q4 9618/21/M/J/23 original Q3 Structured · 11 marks Worked solution (a)(i) Write the structure: record [1] Advantage: a record holds all the data about one customer [1] ...data of different types (string, integer, date) [1] ...all held under a single identifier [1] (a)(ii) Write: a 1D array of records (one record for each customer). One mark for array, one for records. Array [1] Records [1] (b) Break the algorithm into five steps: 1 Input the amount spent (stored in a numeric variable); constants or variables can hold the thresholds 10 and 100 [1] 2 Work out which band the amount falls into (compare with 10 and 100) [1] 3 Work out the whole number of dollars in the amount (round down, ignoring the cents) [1] 4 Multiply the whole dollars by 5, 7 or 10, depending on the band [1] 5 Output the number of points [1] Other correct orders and wording also score if each point is covered. KEY IDEA Use a record for mixed-type data about one item, and an array of records for many items. TOTAL 11 marks Official mark scheme VIDEO ▶ Starts at Q3 (18:04) Starts at Q3 (18:04) · by Pseudocode Pro. Tap the picture to open it on YouTube.