Question 6(b) 2024 · October-November · Paper 21 · 3 marks
Reveal official mark-scheme answer
Official answer for Question 6
Part (b)
Question 3
Show text version of question
Question 6
Part (b)
Question 6
An incomplete algorithm has been written in pseudocode to count the number of zeros stored in
an array and total the non-zero values.
01 DECLARE A[1:50] : INTEGER 02 DECLARE C : INTEGER 03 DECLARE I : INTEGER 04 DECLARE T : INTEGER 05 I ← 0
06 ........................................................................................................ 07 FOR C ← 1 TO 50 08 IF A[C] .............................................................................. 09 THEN 10 T ← T + 1 11 ELSE 12 I ← I + A[C] 13 ENDIF
14 ........................................................................................................
Part (b)
Write the pseudocode to display, with suitable messages, the number of zeros stored in the
array and the total of the non-zero values.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................
Why this question appears here
98% assigned-topic match · Programming › Arrays
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_w24_qp_21.pdf
