Cambridge AS Level Computer Science 9618 · 11.2 Constructs

Q58 · 9618/21/M/J/25 Q1

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

Q589618/21/M/J/25original Q1Structured · 12 marks
Question 1 from 9618/21/M/J/25

Worked solution

(a)

Choose a clear name and the type that fits the example value:

Example valueExplanationVariable nameData type
"Fruit"a category of stock that is sold in the shopCategorySTRING
20/02/2025when an item was soldDateSoldDATE
12.67the cost of an itemItemCostREAL
TRUEto indicate if an item is in stockInStockBOOLEAN

Category, STRING [1]

DateSold, DATE [1]

ItemCost (or Price), REAL [1]

InStock, BOOLEAN [1]

(b)

Look for an arrow (assignment), an IF or CASE (selection) and a loop (iteration):

Pseudocode extractAssignmentSelectionIteration
Result ← CalculateTotal()✓
WHILE IsClosed✓
REPEAT INPUT Value UNTIL Sales[4] > Value✓✓
IF Sales[Current] <= 150 THEN ... ENDIF✓✓
CASE OF Option✓

Row 1 correct [1]

Row 2 correct [1]

Row 3 correct (INPUT stores a value, so assignment as well as iteration) [1]

Row 4 correct [1]

Row 5 correct [1]

(c)

Write any three of these:

Decomposition means breaking a problem down into smaller sub-problems [1]

so that each part of how the stock control is managed can be understood in more detail [1]

This leads to a program designed as a series of modules (procedures and functions), for example separate stock control modules [1]

It makes the program easier to test and debug (also scores, but 3 marks is the maximum)

Maximum 3 marks, and maximum 2 if stock control is not mentioned.

KEY IDEAName variables clearly with the right data type, and break big problems into small modules.
TOTAL 12 marks

Official mark scheme

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

Video solution of the whole paper · by Sir Sikandar Raza. 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.