9618/21/M/J/22 question 1: worked solution (May/June 2022, paper 21)

Show as plain text

Cambridge AS Level Computer Science 9618 · 11.1 Programming Basics Worked solution from the Programming Paper 2 Problem-solving and Programming booklet, Part 1 of 3. Q5 9618/21/M/J/22 original Q1 Structured · 11 marks Worked solution (a) Write: algorithm [1] (b)(i) Variable Data type Temp REAL PetName STRING MyDOB DATE LightOn BOOLEAN Temp: REAL , as an average can have decimals [1] PetName: STRING [1] MyDOB: DATE [1] LightOn: BOOLEAN , as it is only on or off [1] (b)(ii) Write: variable Temp [1] Reason: the name does not say what it is used for (it should be something like AverageTemperature) [1] (c) Expression Evaluation INT((31 / 3) + 1) 11 MID(TO_UPPER("Version"), 4, 2) "SI" TRUE AND (NOT FALSE) TRUE NUM_TO_STR(27 MOD 3) "0" 31 / 3 = 10.33, + 1 = 11.33, INT gives 11 [1] "VERSION", characters 4 and 5: "SI" [1] NOT FALSE = TRUE, TRUE AND TRUE = TRUE [1] 27 MOD 3 = 0, as a string: "0" [1] KEY IDEA Pick data types from the use of the data, and evaluate nested functions from the inside outwards. TOTAL 11 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by CS BY AQIB KHAN. Tap the picture to open it on YouTube.