9618/21/M/J/23 question 1: worked solution (May/June 2023, paper 21)
Show as plain textHide plain text
Cambridge AS Level Computer Science 9618 · 12.3 Program Testing and Maintenance Worked solution from the Software Development Paper 2 Problem-solving and Programming booklet, Part 3 of 3. Q43 9618/21/M/J/23 original Q1 Structured · 10 marks Worked solution (a) Write any two tools, each with what it does: Set a breakpoint [1] It stops the program at a chosen line so the values of variables can be checked at that point [1] Use a watch window (report window) [1] It shows the values of chosen variables as the program runs [1] Single stepping also scores: it runs one line at a time so the effect of each statement can be seen. (b) Statement 1: the brackets are in the wrong place. A number (2) is added to a string ("27"), which is not valid, and STR_TO_NUM needs a string. [1] Statement 2: no error . [1] Statement 3: MONTH() returns an integer but it is compared with a character '6'. The 6 should not be in quotes. [1] (c)(i) Work each one out with Active = TRUE, Points = 75, Exempt = FALSE: Expression Evaluation (Points > 99) OR Active TRUE (Points MOD 2 = 0) OR Exempt FALSE (Points <= 75) AND (Active OR Exempt) TRUE (Active OR NOT Active) AND NOT Exempt TRUE Any two rows correct [1] All four rows correct [1] (c)(ii) Active OR NOT Active is always TRUE, so only the second part is left: NOT Exempt [1] KEY IDEA Debug tools let you pause and watch variables, and a value OR its own NOT is always TRUE. TOTAL 10 marks Official mark scheme VIDEO ▶ Starts at Q1 (0:21) Starts at Q1 (0:21) · by Pseudocode Pro. Tap the picture to open it on YouTube.