Cambridge AS Level Computer Science 9618 · 12.3 Program Testing and Maintenance

Q43 · 9618/21/M/J/23 Q1

Worked solution from the Software Development Paper 2 Problem-solving and Programming booklet, Part 3 of 3.

Q439618/21/M/J/23original Q1Structured · 10 marks
Question 1 from 9618/21/M/J/23

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:

ExpressionEvaluation
(Points > 99) OR ActiveTRUE
(Points MOD 2 = 0) OR ExemptFALSE
(Points <= 75) AND (Active OR Exempt)TRUE
(Active OR NOT Active) AND NOT ExemptTRUE

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 IDEADebug tools let you pause and watch variables, and a value OR its own NOT is always TRUE.
TOTAL 10 marks

Official mark scheme

Mark scheme for 9618/21/M/J/23 question 1
VIDEO
▶ Starts at Q1 (0:21)

Starts at Q1 (0:21) · by Pseudocode Pro. Tap the picture to open it on YouTube.

Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.