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

Question 6(b) 2025 · May-June · Paper 21 · 2 marks

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

Official answer for Question 6

Part (b)

✓
One mark for method, one mark for example – max 2.

Question 2

✓
•
✓
Meaningful identifiers, N should be Number.
✓
•
✓
Comments, // loops until the guess equals the number
✓
•
✓
Procedures/functions, making the algorithm a procedure/function
✓
0478/21
✓
Cambridge IGCSE – Mark Scheme
✓
May/June 2025
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 0478_s25_ms_21.pdf →

Show text version of question

Question 6

Part (b)

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 (b)

Identify one method to make the algorithm maintainable.

Give an example.

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

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

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

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

[2]

Question 7

, ,

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