Past-paper question · 2023 October-November · Paper 21 · Q4(b)

Question 4(b) 2023 · October-November · Paper 21 · 11 marks

Original past-paper question for 4(B)
Original past-paper question for 4(B)
Original past-paper question for 4(B)
Original past-paper question for 4(B)
Original past-paper question for 4(B)
Reveal official mark-scheme answer Official mark-scheme answer for 4(B)

Official answer for Question 4

Part (b)

✓
MP1 Test for row being even number

Question 3

✓
MP2 Test for either column value equal to Search
✓
IF Row MOD 2 = 0 AND __
✓
(Data[Row, 1] = Search OR Data[Row, 2] = Search) THEN
✓
ALTERNATIVE using nested IFs:
✓
IF Row MOD 2 = 0 THEN
✓
IF Data[Row, 1] = Search OR Data[Row, 2] = Search THEN
✓
MP3 Selection structure is either:
  • Single IF statement using AND, or
  • Two nested IFs using AND, or
  • Single IF and the use of a two-iteration loop
✓
Either of these structures correctly formed scores the mark
✓
ALTERNATIVE SOLUTION: A FOR loop using ‘STEP 2’
✓
FOR Row 2 TO 150 / NEXT Row
✓
STEP 2
✓
Data[Row, 1] = Search OR Data[Row, 2] = Search) THEN
✓
Cambridge International AS & A Level – Mark Scheme
✓
9618/21
✓
October/November
✓
PUBLISHED
✓
2023
✓
Question
✓
Answer
✓
Marks

Mark scheme 9618_w23_ms_21.pdf →

Show text version of question

Question 4

Part (b)

Question 4

TopOfStack

3 BottomOfStack

Question 2

Question 1

[3]

Question 5

Part (b)

A function Push() will add a value onto the stack by manipulating the array and variables in

part (a).

Before adding a value onto the stack, the algorithm will check that space is available.

If the value is added to the stack, the function will return TRUE, otherwise it will return FALSE.

The algorithm is expressed in five steps.

Complete the steps.

1. If ........................................................ then return FALSE

2. Otherwise .......................................... TopOfStack

3. Use TopOfStack as an ................................... to the array.

4. Set the element at this ...................................... to the .............................. being added.

5. Return .............................. .

[5]

Question 6

4 A global array is declared in pseudocode as follows:

DECLARE Data : ARRAY[1:150] OF STRING

A
function TooMany() will:

1. take two parameters:

  • a string (the search string)
  • an integer (the maximum value)

2. count the number of strings in the array that exactly match the search string 3. return TRUE if the count is greater than the maximum value, otherwise will return FALSE

Part (b)

The global array is changed to a 2D array, organised as 150 rows by 2 columns. It is declared

in pseudocode as follows:

DECLARE Data : ARRAY[1:150, 1:2] OF STRING

The algorithm for the function in part

Part (a)

is changed. Strings will only be counted if both of

the following conditions are true:

  • The current row is an even number.
  • The search string exactly matches the value in either column.

Write pseudocode to check these conditions.

Assume that the row index is contained in variable Row and the search string in variable Search.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................

[3]

Question 8

Topic relevance

Why this question appears here

99% assigned-topic match · Programming › Constructs

Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.

Permanent source page: Educate A Change · From 9618_w23_qp_21.pdf

Keep practising this topic