Worked solution from the Programming Paper 2 Problem-solving and Programming booklet, Part 1 of 3.
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]
Write: use constants for the tax rates [1]
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.
| Variable name | Data type |
|---|---|
| HighRate | BOOLEAN |
| TaxPayable | REAL |
HighRate is BOOLEAN [1]
TaxPayable is REAL [1]
Write: OTHERWISE [1]
▶ 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.