Cambridge AS Level Computer Science 9618 · 11.3 Structured Programming

Q89 · 9618/23/M/J/25 Q1

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

Q899618/23/M/J/25original Q1Structured · 14 marks
Question 1 from 9618/23/M/J/25

Worked solution

(a)(i)

Write any two of these:

A task that is repeated can be written once and reused or called from several places [1]

A specific task can be coded as its own module, which makes the program simpler [1]

Also accepted: a module may already be available, or testing, debugging and maintenance are easier

(a)(ii)

Write one of these:

A local variable can only be used inside the module where it is declared, but a global variable can be used by the whole program [1]

A local variable uses memory only while its module runs, but a global variable uses memory all the time the program runs (also accepted).

(a)(iii)

Write any two of these:

The same variable name can be reused in other modules [1]

The module is self-contained, so it cannot accidentally change a variable outside it [1]

Also accepted: it helps modularisation, or the memory can be reused when the module is not running

(b)

Use the insert's functions to complete each row:

ExpressionEvaluates to
CHR(68)'D'
MONTH(04/02/2025)2
NOT TRUEFALSE
STR_TO_NUM(MID("Court1.4Upper", 6, 3))1.4

CHR [1]

MONTH (or DAY(...) - 2, or YEAR(...) - 2023) [1]

NOT (or FALSE = TRUE) [1]

STR_TO_NUM around the MID function [1]

MID("Court1.4Upper", 6, 3), which starts at character 6 and takes 3 characters [1]

(c)

Choose the type from how each value is used:

VariableData type
MemberCountINTEGER
TotalTakingsREAL
BookingConfirmedBOOLEAN
MemberDOBDATE

MemberCount is a whole number: INTEGER [1]

TotalTakings is money with decimals: REAL [1]

BookingConfirmed has two states: BOOLEAN [1]

MemberDOB is a date: DATE [1]

KEY IDEAModules and local variables keep code reusable and safe; pick data types from how the value is used.
TOTAL 14 marks

Official mark scheme

Mark scheme for 9618/23/M/J/25 question 1
VIDEO
▶ Whole paper

Video solution of the whole paper · by Awab Aqib. 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.