Cambridge AS Level Computer Science 9618 · 11.1 Programming Basics

Q25 · 9618/21/O/N/24 Q1

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

Q259618/21/O/N/24original Q1Structured · 9 marks
Question 1 from 9618/21/O/N/24

Worked solution

(a)

The tax rate is a percentage, so it must be divided by 100.

Error: TaxPayable is calculated incorrectly (ItemCost * TaxRate is 100 times too big) [1]

Correction: write TaxPayable ← (ItemCost * TaxRate) / 100 [1]

(b)(i)

Write: use constants for the tax rates [1]

(b)(ii)

Write any three of these:

Each tax rate is entered once only [1]

It avoids input errors, accidental changes or different values for the same rate at different places [1]

When a rate changes it is changed once, so the program is easier to maintain [1]

The program is easier to understand (a name tells you what the value is for). Only three of these can score.

(c)

Variable nameData type
HighRateBOOLEAN
TaxPayableREAL

HighRate is BOOLEAN [1]

TaxPayable is REAL [1]

(d)

Write: OTHERWISE [1]

KEY IDEAPercentages need dividing by 100, and fixed values belong in named constants.
TOTAL 9 marks

Official mark scheme

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

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