Skip to main content
A-LevelComputer ScienceProgramming9618/21 · Oct/Nov 2024 · Q29 Marks

A program uses three global integer variables HH, MM and SS to represent the current time in hours, minutes and seconds using the 24-hour clock notation. Midnight would be represented as 00:00:00 (HH:MM:SS). If the variables HH, MM and SS contained the values 16, 30 and 10 respectively, then the time would be 16:30:10 or just after 4.30 in the afternoon. A procedure Tick() will be called every second. The procedure Tick() will: • update the value in SS each time it is called • update the values in HH and MM as appropriate • call a procedure CheckAlarm() at the start of each minute • call a procedure NewDay() whenever the time reaches midnight. Complete the pseudocode for procedure Tick(). PROCEDURE Tick() (a) By examining the program and understanding how the variables are manipulated during execution, it is evident that the calculation performed to determine `TaxPayable` is incorrect. The tax rate, being a percentage (e.g., 3.75 for 3.75%), must be divided by 100 before multiplication to get the correct decimal equivalent for the calculation. The correction required is to modify the assignment statement to: `TaxPayable ← ItemCost * (TaxRate / 100)`. (b)(i) To ensure that tax rates are consistently used and easily manageable, a more appropriate way to represent these values in the final program is to use named constants. (b)(ii) The benefits of using named constants for tax rates are that these rates only need to be entered once, reducing the potential for data entry errors and ensuring that the same rate is used throughout the program. This approach minimises the risk of accidentally changing tax rates at different points in the program. If a constant's value needs to be updated (e.g., due to a change in tax law), the change is made in a single location, which makes the program easier to maintain, modify, and understand. (c) The appropriate data types for the given variables, as used in the pseudocode, are: - `HighRate`: BOOLEAN - `TaxPayable`: REAL (d) The final `CASE` condition `> 200` in the pseudocode example could be replaced with the keyword `OTHERWISE` to handle any value not explicitly covered by the preceding conditions.

  1. (a)The pseudocode contains a logical error. Identify the error and suggest a correction. Error Correction[2]
  2. (b)(i)During the design of the program, tax rate values have been used wherever they are needed as shown in the pseudocode example above. Tax rates do not change while the program runs. Identify a more appropriate way of representing the tax rate values in the final program.[1]
  3. (b)(ii)Describe the benefits of your answer to part (b)(i) with reference to this program.[3]
  4. (c)Give the appropriate data type for the variables in the following table, as used in the pseudocode: Variable name | Data type ---|--- HighRate | TaxPayable |[2]
  5. (d)The final CASE condition (> 200) in the pseudocode example could be replaced with a keyword. Give the keyword.[1]

Mark scheme

Marking points from the official mark scheme (Oct/Nov 2024). The mark or mark type is shown in brackets.

  1. [1] (a) Error: The calculation of TaxPayable is incorrect
  2. [1] (a) Correction: TaxPayable ← (ItemCost * TaxRate) / 100
  3. [1] (b)(i) Use constants (to represent the tax rate values)
  4. [1] (b)(ii) Tax rates are entered once only
  5. [1] (b)(ii) Avoids / Minimise (input) error(s) / changing the Tax rates accidentally // avoids different values for tax rates at different points in the program
  6. [1] (b)(ii) When required, the constant value (representing a tax rate) is changed (once) // Easier to maintain / update the program (when the tax rates change)
  7. [1] (b)(ii) Makes the program / code easier to understand
  8. [1] (c) HighRate: Boolean
  9. [1] (c) TaxPayable: Real
  10. [1] (d) OTHERWISE

Write your answer and get it marked

On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.

Sign up free →

About this question

Topic
Programming, A-Level Computer Science (syllabus 9618). Structured question, 9 marks.
Source
A-Level Computer Science, Oct/Nov 2024 Paper 2 Variant 1, question 2.

Questions and mark schemes are from past examination papers and remain the copyright of the exam board. How Oracle Prep builds its content

Related Computer Science questions

© 2026 Oracle Prep