Cambridge AS Level Computer Science 9618 · 11.3 Structured Programming

Q93 · 9618/23/O/N/25 Q1

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

Q939618/23/O/N/25original Q1Structured · 10 marks
Question 1 from 9618/23/O/N/25

Worked solution

(a)

Write any three of these:

Library routines are tried and tested, so they are free from errors. [1]

They are readily available, which speeds up development. [1]

They are updated automatically when improved, so no maintenance is needed. [1]

The algorithm will follow the international standard. (Also accepted for the third mark.)

(b)(i)

Write any two of these:

The subroutine does one specific task. [1]

The code is used in several places so it is written once. [1]

Testing, debugging or maintenance is easier. (Also accepted.)

(b)(ii)

TermDescription
Pass2the name of the function
Countthe parameter passed to the function
BOOLEANthe data type of the value the function returns

Count described as the parameter [1]

BOOLEAN described as the return type [1]

(c)

LENGTH of "2.5" is 3. MONTH(DoB) is 6, and 6 > 4 is TRUE. The 2nd character of the address is "5", so 15 + 5 = 20.

ExpressionEvaluates to
LENGTH(NUM_TO_STR(Multiplier))3
MONTH(DoB) > 4TRUE
15 + STR_TO_NUM(MID(AddressLine[1], 2, 1))20

3 [1]

TRUE [1]

20 [1]

KEY IDEALibrary routines save time and are already tested; subroutines avoid repeated code and make testing easier.
TOTAL 10 marks

Official mark scheme

Mark scheme for 9618/23/O/N/25 question 1
VIDEO
▶ Topic lesson

A lesson on this topic · by ZAINEMATICS. 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.