9618/23/M/J/23 question 2: worked solution (May/June 2023, paper 23)
Show as plain textHide 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. Q13 9618/23/M/J/23 original Q2 Structured · 6 marks Worked solution (a) Use the DAYINDEX() function. Sunday is 1, so Thursday is 5. Write: IF DAYINDEX(MyDOB) ... THEN (the function applied to MyDOB) [1] Write: ... = 5 (the comparison with 5) [1] (b)(i) Write the two checks that need only one parameter each: Check the month is between 1 and 12 (inclusive) [1] Check the year is 2002 or earlier (so the student is at least 18 in 2020) [1] (b)(ii) The day depends on the month. Write: the check uses the month and the day together [1] Write: the day must be possible for that month, for example no day 31 in a 30-day month (and a month-based limit for February) [1] KEY IDEA Some checks need one value only (a range), while others need a second value (day depends on month). TOTAL 6 marks Official mark scheme VIDEO ▶ Starts at Q2 (21:00) Starts at Q2 (21:00) · by Zafar Ali Khan (ZAK). Tap the picture to open it on YouTube.