9618/23 · May/June 2022 · 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 row 5

Mark points

  • Include the ideas shown in the solution above.

Part 1(b)(i) — solution

1 mark for any two rows correct 2

Mark points

  • Include the ideas shown in the solution above.

Part 1(b)(ii) — solution

  1. To terminate a (conditional) loop when a value has been found
  2. When the variable can take only one of two possible values
  3. (Accept by example): When a variable is recording when an action has

Mark points

  • To terminate a (conditional) loop when a value has been found
  • When the variable can take only one of two possible values
  • (Accept by example): When a variable is recording when an action has

Part 1 — solution

Four boxes linked as shown correctly labelled (Order of lower 3 not important)

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Procedure heading and ending and declaration of loop counter

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Function heading and ending including parameter and return value

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Function heading and ending including parameter and return value

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

(at least) three intermediate shapes with at least one valid stage names

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Declaration and initialisation of Password as STRING

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Check that the website domain name isn't already in array using FindPassword() / linear search, otherwise:

Mark points

  • Include the ideas shown in the solution above.

Question 2

Paper page 3 for Q2
Original paper page 3

Part 2 — solution

Dependent marks 4 One mark for type; one mark for matching reason Answers include: Type: Adaptive Reason: To accommodate a change in the requirement / technology / legislation e.g. a new HTML version is available Type: Corrective Reason: The program does not operate as expected / contains a bug e.g. passwords are not hidden

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Declaration and initialisation (to 1) of local Integer Value for result

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Up and Down arrows between each pair of shapes

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Outer loop for three groups / until password is complete // three group loops

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

(Conditional) loop while not added and not end of array

Mark points

  • Include the ideas shown in the solution above.

Question 3

Paper page 4 for Q3
Original paper page 4

Part 3(a) — solution

  1. module relationships / hierarchy / selection / repetition // how a problem is
  2. the parameters that are passed between the sub-tasks / modules //

Mark points

  • module relationships / hierarchy / selection / repetition // how a problem is
  • the parameters that are passed between the sub-tasks / modules //

Part 3(b) — solution

Answer: 5

5 One mark for each:

Mark points

  • Correct result: 5

Part 3 — solution

and if so return product of Thisnum and Factorial(ThisNum-1)

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Design – Coding – Testing labels in correct sequence

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Attempt to use of both RandomChar() and Exists()in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Check for unused element by testing value in column 1 in a loop

Mark points

  • Include the ideas shown in the solution above.

Question 4

Paper page 5 for Q4
Original paper page 5

Part 4 — solution

One mark per row 2 to 7 to Max 4 4 Type of Example Expected Explanation test data test value return value Value within the acceptable Normal 153 "PASS" range Outside acceptable range / Abnormal < 149 "FAIL" too small Abnormal / 149 "FAIL" Maximum unacceptable Boundary Boundary / Extreme / 150 "PASS" Minimum acceptable Normal Boundary / Extreme / 155 "PASS" Maximum acceptable Normal Abnormal / 156 "FAIL" Minimum unacceptable Boundary Outside acceptable range / Abnormal >156 "FAIL" too large

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

  1. test Staff[Index].Attendance <= 90 in a loop

Mark points

  • test Staff[Index].Attendance <= 90 in a loop

Part 4 — solution

(Conditional) loop while ThisNum not zero // loop for ThisNum iterations

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

(Inner) loop for 4 characters in a group // note every 4 chars in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

If unused, write parameter values to column 1 and 2 and set flag / variable

Mark points

  • Include the ideas shown in the solution above.

Question 5

Paper page 6 for Q5
Original paper page 6

Part 5(a)(i) — solution

TYPE Employee 4 DECLARE EmployeeNumber : INTEGER DECLARE Name : STRING DECLARE Department : STRING DECLARE Born : DATE DECLARE Attendance : REAL ENDTYPE One mark for each: 1. TYPE Employee and ENDTYPE 2. Fields: EmployeeNumber and Name and Department 3. Field: Born 4. Field: Attendance

Mark points

  • Include the ideas shown in the solution above.

Part 5(a)(ii) — solution

DECLARE Staff : ARRAY [1:500] OF Employee 2 One mark per underlined phrase 2022 Page 5 of 11 9618/23 Cambridge International AS & A Level – Mark Scheme May/June 2022

Mark points

  • Include the ideas shown in the solution above.

Part 5(b)(i) — solution

  1. So that unused elements may be recognised when processing /
  2. Otherwise the element may contain old / unexpected data

Mark points

  • So that unused elements may be recognised when processing /
  • Otherwise the element may contain old / unexpected data

Part 5(b)(ii) — solution

  1. An EmployeeNumber field. e.g. < 1
  2. An empty string / impossible string e.g. "EMPTY" for name or department
  3. DOB a long time ago
  4. Zero / Negative value for attendance

Mark points

  • An EmployeeNumber field. e.g. < 1
  • An empty string / impossible string e.g. "EMPTY" for name or department
  • DOB a long time ago
  • Zero / Negative value for attendance

Part 5(c) — solution

  1. IF Staff[Index].Attendance <= 90 THEN

Mark points

  • IF Staff[Index].Attendance <= 90 THEN

Part 5 — solution

Attempt to form answer by successive multiplication

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

...return 1 for 0 and 1 and return −1 for negative values

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

...having used Encrypt() on the password

Mark points

  • Include the ideas shown in the solution above.

Question 6

Paper page 8 for Q6
Original paper page 8

Part 6(a) — solution

FUNCTION Factorial(ThisNum : INTEGER) RETURNS INTEGER 6 DECLARE Value : INTEGER IF ThisNum < 0 THEN Value  -1 ELSE Value  1 WHILE ThisNum <> 0 Value  Value * ThisNum ThisNum  ThisNum – 1 ENDWHILE ENDIF RETURN Value ENDFUNCTION Marks as follows to Max 6:

Mark points

  • Include the ideas shown in the solution above.

Part 6(b) — solution

  1. Rows A, B AND C
  2. Each of rows D, E and F

Mark points

  • Rows A, B AND C
  • Each of rows D, E and F

Part 6 — solution

Concatenating unique character to Group in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 6 — solution

Return BOOLEAN value (correctly in all cases)

Mark points

  • Include the ideas shown in the solution above.

Question 7

Paper page 10 for Q7
Original paper page 10

Part 7 — solution

  1. Return INTEGER value correctly in both cases: ThisNum < 0 and >= 0
  2. IF ThisNum = 1 OR ThisNum = 0 THEN

Mark points

  • Return INTEGER value correctly in both cases: ThisNum < 0 and >= 0
  • IF ThisNum = 1 OR ThisNum = 0 THEN

Part 7(a)(i) — solution

The lines are output in an incorrect sequence / in the wrong order / not as 1 they appear in the file

Mark points

  • Include the ideas shown in the solution above.

Part 7(a)(ii) — solution

Answer: OR · OR (two-loop solution, not using an array)

  1. If the final line of the file is not written into array element 3
  2. then outputting the elements in the sequence 1 to 3 will give the error
  3. Attempt at description of 'shuffle'
  4. Copy Buffer[2] to Buffer[1] AND copy Buffer[3] to Buffer[2]
  5. Read a line from the file and write it to Buffer[3]
  6. Store the index of the last element written to buffer (the last line of the
  7. Replace the FOR loop with something that starts at index
  8. and then wraps around (MOD 3)
  9. Loop to read file to end to get number of lines
  10. close and re-open file
  11. read (and discard) lines to number of lines - 3, then loop to read and

Mark points

  • If the final line of the file is not written into array element 3
  • then outputting the elements in the sequence 1 to 3 will give the error
  • Attempt at description of 'shuffle'
  • Copy Buffer[2] to Buffer[1] AND copy Buffer[3] to Buffer[2]
  • Read a line from the file and write it to Buffer[3]
  • Store the index of the last element written to buffer (the last line of the
  • Replace the FOR loop with something that starts at index
  • and then wraps around (MOD 3)
  • Loop to read file to end to get number of lines
  • close and re-open file
  • read (and discard) lines to number of lines - 3, then loop to read and

Part 7(c) — solution

Correct answers include: 2 LineNum  (LineNum MOD 3) + 1 // ((LineNum + 3) MOD 3) + 1 One mark for assignment to LineNum making any use of MOD One for completely correct statement

Mark points

  • Include the ideas shown in the solution above.

Part 7 — solution

Concatenate Group / random character to Password in a loop

Mark points

  • Include the ideas shown in the solution above.

Question 8

Paper page 12 for Q8
Original paper page 12

Part 8(a) — solution

Answer: 3

3 One mark for:

Mark points

  • Correct result: 3

Part 8(b) — solution

Downward arrows: result from one stage is input / passed to the next 2 Upward arrows: more work is required at a previous stage to complete the current stage

Mark points

  • Include the ideas shown in the solution above.

Part 8(c) — solution

For example: 1 Iterative / Rapid Application Development (RAD) 2022 Page 9 of 11 9618/23 Cambridge International AS & A Level – Mark Scheme May/June 2022

Mark points

  • Include the ideas shown in the solution above.

Question 9

Paper page 14 for Q9
Original paper page 14

Part 9(a) — solution

  1. CONSTANT HYPHEN = '-'
  2. UNTIL Exists(Group, NextChar) = FALSE

Mark points

  • CONSTANT HYPHEN = '-'
  • UNTIL Exists(Group, NextChar) = FALSE

Part 9(b) — solution

  1. IF FindPassword(Name) = "" THEN // Domain name not in
  2. WHILE Added = FALSE AND Index <= 500
  3. IF Secret[Index, 1] = "" THEN

Mark points

  • IF FindPassword(Name) = "" THEN // Domain name not in
  • WHILE Added = FALSE AND Index <= 500
  • IF Secret[Index, 1] = "" THEN

Part 9(c) — solution

  1. Convert the length of the website domain name (either field) …
  2. … to a string of fixed length
  3. Form a string by concatenate this string with the other two (and write as
  4. Select a (separator) character that cannot occur in the domain name (e.g
  5. Create a string from the domain name followed by the separator
  6. ...Concatenate the encrypted password (and write as one line of the file)

Mark points

  • Convert the length of the website domain name (either field) …
  • … to a string of fixed length
  • Form a string by concatenate this string with the other two (and write as
  • Select a (separator) character that cannot occur in the domain name (e.g
  • Create a string from the domain name followed by the separator
  • ...Concatenate the encrypted password (and write as one line of the file)