9618/21/O/N/24 question 1: worked solution (October/November 2024, paper 21)
Show as plain textHide plain text
Cambridge AS Level Computer Science 9618 · 11.1 Programming Basics Worked solution from the Programming Paper 2 Problem-solving and Programming booklet, Part 1 of 3. Q25 9618/21/O/N/24 original Q1 Structured · 9 marks 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 name Data type HighRate BOOLEAN TaxPayable REAL HighRate is BOOLEAN [1] TaxPayable is REAL [1] (d) Write: OTHERWISE [1] KEY IDEA Percentages need dividing by 100, and fixed values belong in named constants. TOTAL 9 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by Pseudocode Pro. Tap the picture to open it on YouTube.