9618/21 · October/November 2024 · Worked solutions

Step-by-step solutions based on the mark scheme (not a mark-scheme dump).

Question 1

Paper page 2 for Q1
Original paper page 2

Part 1(a) — solution

One mark per point: 2 Error: The calculation of TaxPayable is incorrect Correction: TaxPayable  (ItemCost * TaxRate) / 100

Mark points

  • Include the ideas shown in the solution above.

Part 1(b)(i) — solution

Use constants (to represent the tax rate values) 1

Mark points

  • Include the ideas shown in the solution above.

Part 1(b)(ii) — solution

One mark per bullet point (or equivalent to max 3): 3

Mark points

  • Include the ideas shown in the solution above.

Part 1(c) — solution

One mark per row: 2 Variable name Data type HighRate Boolean TaxPayable Real

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Loop until given line number (-1) / <parameter> (-1) (lines have been read)

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Loop until given line number + 2 / <parameter> + 2 (lines have been read)

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Declare three variables of TYPE INTEGER to store DD, MM and YY

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

All module identified in correct hierarchy

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Loop through all elements in GradeBoundary array

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Correct syntax used for selection structure(s)

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Procedure heading, parameter and ending.

Mark points

  • Include the ideas shown in the solution above.

Question 2

Paper page 4 for Q2
Original paper page 4

Part 2 — solution

Avoids / Minimise (input) error(s) / changing the Tax rates accidentally // avoids different values for tax rates at different points in the program

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

  1. IF SS = 60 THEN
  2. IF MM = 60 THEN
  3. IF HH = 24 THEN

Mark points

  • IF SS = 60 THEN
  • IF MM = 60 THEN
  • IF HH = 24 THEN

Part 2 — solution

Call CheckAlarm() when SS is set to zero

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Loop until EOF(Result.txt) // EOF // end of file

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

... if end of file is reached then return FALSE

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

The program is simpler/ less complex // Program is easier to design / code / maintain / modify / test / debug

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Correct use of date functions from Insert to extract three integer values representing DD, MM and YY and use/assign to a variable

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Parameters to both Sync and Activate and return values

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Attempt to calculate range, both Lower and Upper, in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Open file in write mode and subsequently close

Mark points

  • Include the ideas shown in the solution above.

Question 3

Paper page 6 for Q3
Original paper page 6

Part 3 — solution

When required, the constant value (representing a tax rate) is changed (once) // Easier to maintain / update the program (when the tax rates change)

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

  1. Test if SS = 60 anywhere in the code …

Mark points

  • Test if SS = 60 anywhere in the code …

Part 3(a) — solution

One mark per emboldened part: 4

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Read a / the / next line (from the file) and store in ThisLine

Mark points

  • Include the ideas shown in the solution above.

Part 3(b) — solution

  1. (Ensuring) the lines are output in correct order
  2. Ordering the last three lines
  3. Ordering the lines so they are in the same order as (they occur) in the file

Mark points

  • (Ensuring) the lines are output in correct order
  • Ordering the last three lines
  • Ordering the lines so they are in the same order as (they occur) in the file

Part 3(c) — solution

Two loop solution 4 One mark per point:

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Loop for three lines // Read three lines // Repeat of 4 and 5 for three lines

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Direct access to days in a month / data (using month number as index) // Can use index / month to (directly) access days in month / data Max 2 marks University Press & Assessment 2024 Page 9 of 13 9618/21 Cambridge International AS & A Level – Mark Scheme October/November PUBLISHED 2024

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Add parameter ShelfLife to DD and use / assign result to a variable

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Completely correct range calculation in a loop

Mark points

  • Include the ideas shown in the solution above.

Question 4

Paper page 8 for Q4
Original paper page 8

Part 4 — solution

Makes the program / code easier to understand

Mark points

  • Include the ideas shown in the solution above.

Part 4(a) — solution

One mark per point: 2 Type: Run-time error Cause: A divide by zero operation is attempted // Attempt to convert a non- numeric string to a number

Mark points

  • Include the ideas shown in the solution above.

Part 4(b) — solution

  1. This part of the algorithm performs a specific task // if the check or
  2. A (similar) subroutine is already available // Library routine is already
  3. The program is simplified / easier to understand / easier to design / code /
  4. Unnecessary code duplication
  5. Errors caused by differences where several copies of the check and

Mark points

  • This part of the algorithm performs a specific task // if the check or
  • A (similar) subroutine is already available // Library routine is already
  • The program is simplified / easier to understand / easier to design / code /
  • Unnecessary code duplication
  • Errors caused by differences where several copies of the check and

Part 4(c) — solution

  1. IF IS_NUM(NumStr1) = TRUE AND IS_NUM(NumStr2) = TRUE

Mark points

  • IF IS_NUM(NumStr1) = TRUE AND IS_NUM(NumStr2) = TRUE

Part 4 — solution

Attempt at using IS_NUM() to check both parameters/strings

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

Extract LastDay from DaysInMonth using MM as Index

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

Test if given mark / parameter, is within range in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

Extract candidate mark from Result array in a loop

Mark points

  • Include the ideas shown in the solution above.

Question 5

Paper page 10 for Q5
Original paper page 10

Part 5 — solution

... if end of file is reached then return FALSE

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

Continue to order the last three lines read in the loop // Steps 4 to 6 stay the same

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

Attempt at using of STR_TO_NUM() to convert both parameters/strings

Mark points

  • Include the ideas shown in the solution above.

Part 5(a) — solution

Answer: 5

5 Name of life Activity cycle stage The walkthrough method is used. Testing An algorithm is implemented in a programming language. Coding The client is interviewed about problems with the current Analysis system. The program is modified to run on new hardware. Maintenance Records and file structures are defined. Design One mark per row

Mark points

  • Correct result: 5

Part 5(b)(i) — solution

One mark per row 4 Type of test data Test data value Expected result Abnormal 12 (< 23) FALSE Abnormal / Boundary / Extreme 23 FALSE Boundary / Extreme 24 TRUE Boundary 25 TRUE Boundary 36 TRUE Boundary /Extreme 37 TRUE Abnormal / Boundary / Extreme 38 FALSE Abnormal 99 (> 38) FALSE Max 4 marks

Mark points

  • Include the ideas shown in the solution above.

Part 5(b)(ii) — solution

Integration (testing) 1

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

Test for new DD after end of month / DaysInMonth[MM] … and if DD > DaysInMonth[MM]:

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

Set variable / immediate RETURN if recheck required in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

Use of CheckMark() with candidate mark as parameter in a loop

Mark points

  • Include the ideas shown in the solution above.

Question 6

Paper page 12 for Q6
Original paper page 12

Part 6 — solution

When MM is set to 60 set MM to 0 and increment HH

Mark points

  • Include the ideas shown in the solution above.

Part 6 — solution

After outputting the (required) lines return TRUE

Mark points

  • Include the ideas shown in the solution above.

Part 6 — solution

(If FALSE has not been returned) output the required three lines (in the correct order)

Mark points

  • Include the ideas shown in the solution above.

Part 6(a) — solution

One mark per point: 2

Mark points

  • Include the ideas shown in the solution above.

Part 6(b) — solution

  1. IF MM = 13 THEN

Mark points

  • IF MM = 13 THEN

Part 6 — solution

MM is incremented by 1 and DD is set to DD – DaysInMonth[MM]

Mark points

  • Include the ideas shown in the solution above.

Part 6 — solution

Return Boolean in both cases following a reasonable attempt Selection example solution FUNCTION CheckMark(Mark : INTEGER) RETURNS BOOLEAN CASE OF Mark GradeBoundary[1] – 2 TO GradeBoundary[1] + 2 : RETURN TRUE GradeBoundary[2] – 2 TO GradeBoundary[2] + 2 : RETURN TRUE GradeBoundary[3] – 2 TO GradeBoundary[3] + 2 : RETURN TRUE GradeBoundary[4] – 2 TO GradeBoundary[4] + 2 : RETURN TRUE GradeBoundary[5] – 2 TO GradeBoundary[5] + 2 : RETURN TRUE OTHERWISE : RETURN FALSE ENDCASE ENDFUNCTION Mark as follows:

Mark points

  • Include the ideas shown in the solution above.

Part 6 — solution

Test return value and if TRUE then increment Count in a loop

Mark points

  • Include the ideas shown in the solution above.

Question 7

Paper page 14 for Q7
Original paper page 14

Part 7 — solution

When HH is set to 24 set HH to 0 and call NewDay() Max 6 marks

Mark points

  • Include the ideas shown in the solution above.

Part 7 — solution

After the loop, close the file (Result.txt)

Mark points

  • Include the ideas shown in the solution above.

Part 7 — solution

Ordering of lines no longer needed Max 4 marks Alternative solution One loop solution mark scheme that reads to given line number + 2 One mark per point

Mark points

  • Include the ideas shown in the solution above.

Part 7 — solution

… and if so correct calculation and assignment to Value field

Mark points

  • Include the ideas shown in the solution above.

Part 7 — solution

  1. If MM = 13 / MM > 12 then increment YY and set MM to 1

Mark points

  • If MM = 13 / MM > 12 then increment YY and set MM to 1

Part 7(a) — solution

Answer: 5

5 One mark per point:

Mark points

  • Correct result: 5

Part 7(b) — solution

Explanation: 2 Means that Sync repeatedly calls Reset and (then) Enable One mark for each point: MP1: reference to iteration MP2: naming all three modules correctly including correct sequence of calls University Press & Assessment 2024 Page 11 of 13 9618/21 Cambridge International AS & A Level – Mark Scheme October/November PUBLISHED 2024

Mark points

  • Include the ideas shown in the solution above.

Question 8

Paper page 16 for Q8
Original paper page 16

Part 8 — solution

Use of SETDATE to assign value to NewDate, NewDate must have been delared as a type DATE

Mark points

  • Include the ideas shown in the solution above.

Part 8(a) — solution

  1. IF Mark >= Lower AND Mark <= Upper THEN

Mark points

  • IF Mark >= Lower AND Mark <= Upper THEN

Part 8(b) — solution

  1. IF CheckMark(ThisMark) = TRUE THEN

Mark points

  • IF CheckMark(ThisMark) = TRUE THEN

Part 8 — solution

... after conversion to a string in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 8(c) — solution

The file will need to be opened in APPEND mode 1 University Press & Assessment 2024 Page 13 of 13

Mark points

  • Include the ideas shown in the solution above.

Question 9

Part 9 — solution

Final output of message giving number of papers to check not in a loop Max 8 marks

Mark points

  • Include the ideas shown in the solution above.