Past-paper question · 2025 May-June · Paper 21 · Q6(a)

Question 6(a) 2025 · May-June · Paper 21 · 4 marks

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

Official answer for Question 6

Part (a)

✓
One mark for each line identified and corrected.

Question 4

✓
Line 02 – should be N ← ROUND(RANDOM() * 99, 0) + 1
✓
Line 12 – should be OUTPUT "The number is higher than your guess"
✓
Line 14/15 - Counter ← Counter + 1 should be placed after Line 15/After ENDIF/before UNTIL G = N/before Line

Question 16

✓
Line 17 – should be OUTPUT "Well done, you took ", Counter, " attempts"

Mark scheme 0478_s25_ms_21.pdf →

Show text version of question

Question 6

Part (a)

Question 6

An algorithm has been written in pseudocode to generate a random integer between 1 and 100

inclusive and store the value in N. The user enters a guess for the number and the algorithm indicates whether the guess is higher or lower than the random number. The algorithm outputs the number of guesses when the user has correctly guessed the random number.

01 Counter 0 02 N ROUND(RANDOM() * 99, 1) + 1 03 REPEAT 04 OUTPUT "Please enter a guess" 05 INPUT G 06 IF G > N

07 THEN 08 OUTPUT "The number is lower than your guess" 09 ELSE 10 IF G < N 11 THEN 12 OUTPUT "The number is lower than your guess" 13 ENDIF 14 Counter Counter + 1 15 ENDIF 16 UNTIL G = N 17 OUTPUT "Well done, you took ", Guess, " attempts"

Part (a)

Identify the line numbers of the four errors in the pseudocode and suggest a correction for

each error.

Error 1 line number ............................

Correction .................................................................................................................................

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

Error 2 line number ............................

Correction .................................................................................................................................

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

Error 3 line number ............................

Correction .................................................................................................................................

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

Error 4 line number ............................

Correction .................................................................................................................................

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

[4]
Topic relevance

Why this question appears here

98% assigned-topic match · Algorithm design and problem-solving

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 0478_s25_qp_21.pdf

Keep practising this topic