Past-paper question · 2022 October-November · Paper 21 · Q2(a)

Question 2(a) 2022 · October-November · Paper 21 · 6 marks

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

Official answer for Question 2

Part (a)

✓
One mark per mark point, max six

Question 6

✓
•
✓
Line 1 100
✓
•
✓
Line 7 Value > 100 // Value >= 101
✓
•
✓
Line 11 Reading[Value] + 1
✓
•
✓
Line 14 INPUT Value
✓
•
✓
Line 18 Reading[Count]
✓
•
✓
Line 19 Count – 1
✓
Cambridge IGCSE – Mark Scheme
✓
0478/21
✓
October/November 2022
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 0478_w22_ms_21.pdf →

Show text version of question

Question 2

Part (a)

Question 2

An algorithm has been written to:

  • set 100 elements of the array Reading[1:100] to zero
  • input integer values between 1 and 100
  • end the process with an input of –1
  • reject all other values
  • count and output the number of times each value is input, starting with the largest value.

Part (a)

Complete the pseudocode algorithm:

01 FOR Count 1 TO ....................................................................................................

O2 Reading[Count] 0

03 NEXT Count

04 OUTPUT "Please enter next reading "

05 INPUT Value

06 WHILE Value <> -1 DO

07 IF Value <= 0 OR .................................................................................................

08 THEN

09 OUTPUT "Reading out of range"

10 ELSE

11 Reading[Value] .......................................................................................

12 ENDIF

13 OUTPUT "Please enter next reading "

14 ......................................................................................................................................

15 ENDWHILE

16 Count 100

17 REPEAT

18 OUTPUT "There are ", ............................................................................., " readings of ", Count

19 Count ...................................................................................................................

20 UNTIL Count = 0

[6]

Question 9

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

Keep practising this topic