Past-paper question · 2022 May-June · Paper 23 · Q4(c)

Question 4(c) 2022 · May-June · Paper 23 · 3 marks

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

Official answer for Question 4

Part (c)

✓
One mark per mark point, max three

Question 3

✓
MP1
✓
insert a WHILE loop … // pre-condition loop
✓
MP2
✓
… after Input Number
✓
MP3
✓
… with a condition to enter the loop Number < 3
✓
MP4
✓
an error message included within the loop to ask for a re-entry of Number
✓
MP5
✓
…with another input prompt for Number
✓
MP6
✓
ENDWHILE closes the loop and the program carries on from REPEAT in the original algorithm
✓
OR
✓
One mark per mark point, max three
✓
MP1
✓
insert a REPEAT loop … // post-condition loop
✓
MP2
✓
… before Input Number
✓
MP3
✓
a conditional statement should be placed after Input Number
✓
MP4
✓
…to check if Number < 3
✓
MP5
✓
if the number entered is <3, an error message included within the loop to ask for a re-entry of Number
✓
MP6
✓
UNTIL Number >= 3 closes the loop and the program carries on from REPEAT in the original algorithm
✓
0478/23
✓
Cambridge IGCSE – Mark Scheme
✓
May/June 2022
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 0478_s22_ms_23.pdf →

Show text version of question

Question 4

Part (c)

Question 4

The pseudocode represents an algorithm.

The pre-defined function DIV gives the value of the result of integer division. For example, Y = 11 DIV 4 gives the value Y = 2

Count ←0 INPUT Limit FOR In ← ← 1 TO Limit Logic ← TRUE Test 2 INPUT Number REPEAT IF Number / Test = Number DIV Test

← THEN Logic FALSE ELSE Test ←Test + 1 ENDIF UNTIL NOT Logic OR Test >= Number DIV 2 IF Logic

← THEN

← Store[Count] Number Count Count + 1 ENDIF NEXT In FOR Out ← 0 TO Count - 1 OUTPUT Store[Out] NEXT Out

Part (c)

This algorithm only works for numbers that are 3 or greater.

Describe how you could change this algorithm to make sure that only numbers that are 3 or greater are entered. Any pseudocode statements used in your answer must be fully described.

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

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

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

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

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

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

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

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

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

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

[3]

Question 10

Topic relevance

Why this question appears here

73% 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_s22_qp_23.pdf

Keep practising this topic