Past-paper question · 2025 October-November · Paper 21 · Q4(a)

Question 4(a) 2025 · October-November · Paper 21 · 6 marks

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

Official answer for Question 4

Part (a)

✓
Example solution - conditional:

Question 6

✓
PROCEDURE Store()
✓
DECLARE ThisNum, LastNum : REAL
✓
DECLARE Index : INTEGER // index to global array
✓
INPUT ThisNum
✓
LastNum ThisNum
✓
Number[1] ThisNum
✓
INPUT ThisNum
✓
Index 2
✓
WHILE Index < 21 AND ThisNum > LastNum
✓
Number[Index] ThisNum
✓
LastNum ThisNum
✓
Index Index + 1
✓
IF Index < 21 THEN
✓
INPUT ThisNum
✓
ENDIF
✓
ENDWHILE
✓
OUTPUT Index - 1, " values were stored in the array"
✓
ENDPROCEDURE
✓
Alternative loop:
✓
// Loop without using LastNum
✓
WHILE Index < 21 AND ThisNumNum > Number[Index - 1]
✓
Number[Index] ThisNum
✓
Index Index + 1
✓
IF Index < 21 THEN
✓
//skip input if array full
✓
INPUT ThisNum
✓
ENDIF
✓
ENDWHILE
✓
Mark as follows:
✓
1 Declare local variables Index as integer, ThisNum and LastNum as real
✓
2 Input value and assign to first element
✓
3 Attempt at conditional loop including both tests
✓
4 Completely correct conditional loop including both tests
✓
5 Assign input value to current element if greater than previous element
✓
and input next value in a loop
✓
6 Final output giving attempted count of elements stored plus message
✓
after a loop
✓
9618/21
✓
Cambridge International AS & A Level – Mark Scheme
✓
October/November
✓
PUBLISHED
✓
2025
✓
Question
✓
Answer
✓
Marks

Mark scheme 9618_w25_ms_21.pdf →

Show text version of question

Question 4

Part (a)

Question 4

A program contains a global 1D array Number consisting of 20 elements of type REAL

A
procedure Store() will input a sequence of up to 20 real values, one value at a time. These

values will be assigned to elements of the array using four steps:

Step 1: store the first value in the sequence in the first element of the array Step 2: check each subsequent value input. If this value is larger than the previous value input, then assign the value to the next array element, otherwise go to step 4 Step 3: repeat from step 2 unless the array is full Step 4: output the count of the number of values stored in the array together with a suitable message.

Part (a)

Complete the pseudocode for Store()

All variables used in the algorithm must be declared.

PROCEDURE Store()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

ENDPROCEDURE

[6]

* 0000800000007 * DFD

Question 7

, ,

Topic relevance

Why this question appears here

71% assigned-topic match · Algorithm design and problem-solving › Algorithms

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_w25_qp_21.pdf

Keep practising this topic