9618/21 · October/November 2023 · 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: 4 Answer The value assigned to Level when ThisValue is 40 "Medium" The value assigned to Check when ThisValue is 36 12 The value assigned to Level when ThisValue is 18 "Low" The number of elements in array Data that may be 11 incremented

Mark points

  • Include the ideas shown in the solution above.

Part 1(b) — solution

One mark for identifying assignment: 3 MP1 Level  "Very Low" // the level is assigned value “very low” Explanation points: MP2 because CASE clauses are checked in sequence // because of the order of the clauses MP3 a value < 30 satisfies the first clause // Clause '< 20' will never be tested

Mark points

  • Include the ideas shown in the solution above.

Part 1(c) — solution

MP1 all of the possible values are addressed via all / four / three / the other 1 clauses // there are no other possible values to map to OTHERWISE

Mark points

  • Include the ideas shown in the solution above.

Part 1(d) — solution

  1. ThisValue: INTEGER
  2. Check: REAL
  3. Level: STRING

Mark points

  • ThisValue: INTEGER
  • Check: REAL
  • Level: STRING

Question 2

Paper page 3 for Q2
Original paper page 3

Part 2(a) — solution

Max 5 marks 5 MP1 Set total to zero MP2 Input a number MP3 Check if number greater than 29 and less than 71 MP4 … if check is true - add number to total MP5 Repeat from step 2 99 times // for a total of 100 iterations MP6 Output the total

Mark points

  • Include the ideas shown in the solution above.

Part 2(b) — solution

MP1 An iterative construct // a (count-controlled) loop 2 MP2 A selection construct // an IF statement

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

Answer: 3

3 MP1 all values in the order and location shown MP2 TopOfStack value is index of element containing D1 MP3 BottomOfStack value is index of element containing D2

Mark points

  • Correct result: 3

Part 3(b) — solution

  1. MP1 If TopOfStack = 8 // (stack) full then return FALSE 5

Mark points

  • MP1 If TopOfStack = 8 // (stack) full then return FALSE 5

Part 3 — solution

: RetString  MID(Msg, 8, LENGTH(Msg) - 8) OTHERWISE : RetString  "" ENDCASE RETURN RetString ENDFUNCTION MP1 Use of CASE ... ENDCASE or IF ... THEN ... ENDIF MP2 Field 1 and Field 2 extracted correctly MP3 Calculate a length of field 3 MP4 Field 3 extracted correctly MP5 Return empty string in case of invalid parameter (via OTHERWISE or initialisation) MP6 Final RETURN, after a reasonable attempt 2023 Page 10 of 10

Mark points

  • Include the ideas shown in the solution above.

Question 4

Paper page 6 for Q4
Original paper page 6

Part 4(a) — solution

  1. IF Data[Index] = Search THEN

Mark points

  • IF Data[Index] = Search THEN

Part 4(b) — solution

  1. Single IF statement using AND, or
  2. Two nested IFs using AND, or
  3. Single IF and the use of a two-iteration loop

Mark points

  • Single IF statement using AND, or
  • Two nested IFs using AND, or
  • Single IF and the use of a two-iteration loop

Question 5

Paper page 8 for Q5
Original paper page 8

Part 5(a) — solution

  1. MP3 NextInput  "END" should be NextInput = "END"

Mark points

  • MP3 NextInput  "END" should be NextInput = "END"

Part 5(b)(i) — solution

MP1 If all the numeric input values are greater than 999 // If there are no 2 numeric values in the sequence MP2 then the minimum will be given as 999 (and not one of the input values)

Mark points

  • Include the ideas shown in the solution above.

Part 5(b)(ii) — solution

Many possible correct answers, for example: 2 MP1 Mixture non-numeric and numeric with 3 or 4 values - with all numerics greater than 999 Examples: 1325, DOG, 7868, 7615 // SNAKE, 3478, SPIDER MP2 Final value: END

Mark points

  • Include the ideas shown in the solution above.

Question 6

Paper page 10 for Q6
Original paper page 10

Part 6(a) — solution

  1. IF EOL = TRUE THEN

Mark points

  • IF EOL = TRUE THEN

Part 6(b) — solution

MP1 A new (instance of) variable MyString is created each time the 2 procedure is called / executed MP2 So the previous contents are lost

Mark points

  • Include the ideas shown in the solution above.

Question 7

Paper page 12 for Q7
Original paper page 12

Part 7 — solution

Answer: 5

  1. MP1 S2 labelled
  2. MP2 S3, S4 and S5 added
  3. MP3 Line from S1 to S3
  4. MP4 All three lines between S2 and S5 (including S5 to S5)
  5. MP5 Line from S5 to S3 AND from S3 to S4

Mark points

  • MP1 S2 labelled
  • MP2 S3, S4 and S5 added
  • MP3 Line from S1 to S3
  • MP4 All three lines between S2 and S5 (including S5 to S5)
  • MP5 Line from S5 to S3 AND from S3 to S4

Question 8

Paper page 14 for Q8
Original paper page 14

Part 8(a) — solution

  1. CONSTANT STX = CHR(02)
  2. CONSTANT ETX = CHR(03)

Mark points

  • CONSTANT STX = CHR(02)
  • CONSTANT ETX = CHR(03)

Part 8(b) — solution

Max 2 marks 2 MP1 Indicates that all the lines of the file have been sent // it is the end of the transmission / file transfer MP2 So that the receiving program can stop waiting for further data MP3 The file can be closed / saved

Mark points

  • Include the ideas shown in the solution above.

Part 8(c)(i) — solution

MP1 A message cannot contain a zero-length data field 2 MP2 … so a blank line cannot be sent // there is no way to send a blank line

Mark points

  • Include the ideas shown in the solution above.

Part 8(c)(ii) — solution

MP1 Append a (special) character to the start of the message text 2 MP2 interpret the new field data as a blank line ALTERNATIVE MP1 Change the message protocol and use an additional field to act as an indicator MP2 Interpret the new field data 2023 Page 9 of 10 9618/21 Cambridge International AS & A Level – Mark Scheme October/November PUBLISHED 2023

Mark points

  • Include the ideas shown in the solution above.

Part 8(d) — solution

FUNCTION GetField(Msg : STRING, FieldNo : INTEGER) 6 RETURNS STRING DECLARE RetString : STRING CASE OF FieldNo

Mark points

  • Include the ideas shown in the solution above.