Cambridge AS Level Computer Science 9618 · 11.1 Programming Basics

Q4 · 9618/22/O/N/21 Q1

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

Q49618/22/O/N/21original Q1Structured · 11 marks
Question 1 from 9618/22/O/N/21

Worked solution

(a)

Write any two of these points:

Breaking a problem down into smaller parts / sub-problems [1]

This makes the problem easier to understand and solve [1]

It leads to program modules, or parts given to different people (this can score instead of the previous point)

(b)

QuestionAnswer
Number of dimensions of ThisArray1
Terms for minimum and maximum of nlower bound, upper bound
Term for the variable nindex (or subscript)

1 dimension: one index is used [1]

Lower bound and upper bound [1]

Index [1]

(c)

ExpressionEvaluates to
ASC('C')67
2 * STR_TO_NUM("27")54
INT(27 / 2)13
"Sub" & MID("Abstraction", 4, 5)"Subtract"

ASC gives the character code 67 [1]

STR_TO_NUM turns "27" into 27, then 2 * 27 = 54 [1]

27 / 2 = 13.5 and INT gives 13 [1]

Start at character 4 of "Abstraction" and take 5 characters: "tract", so MID, 4, 5 [1]

Function names must be spelled exactly as in the insert.

(d)

Work out each expression with PumpOn = TRUE, PressureOK = TRUE, HiFlow = FALSE:

ExpressionEvaluates to
PressureOK AND HiFlowFALSE
PumpOn OR PressureOKTRUE
NOT PumpOn OR (PressureOK AND NOT HiFlow)TRUE
NOT (PumpOn OR PressureOK) AND NOT HiFlowFALSE

Any two rows correct [1]

All four rows correct [1]

KEY IDEADecomposition splits a problem into smaller parts, and Boolean expressions are worked out by brackets first, then NOT, AND, OR.
TOTAL 11 marks

Official mark scheme

Mark scheme for 9618/22/O/N/21 question 1
VIDEO
▶ Whole paper

Video solution of the whole paper · by CS BY AQIB KHAN. 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.