Question 2(a) 2022 · October-November · Paper 21 · 6 marks
Reveal official mark-scheme answer
Official answer for Question 2
Part (a)
Question 6
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
Question 9
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
