Past-paper question · 2024 October-November · Paper 21 · Q6(b)

Question 6(b) 2024 · October-November · Paper 21 · 3 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 outputting T

Question 3

✓
One mark for outputting I
✓
One mark for suitable messages
✓
Example:
✓
15 OUTPUT "Number of zeros in the array is ", T
✓
16 OUTPUT "Total of non-zero elements in the array is ", I
✓
Cambridge IGCSE – Mark Scheme
✓
0478/21
✓
October/November 2024
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 0478_w24_ms_21.pdf →

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.

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

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

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

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

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

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

[3]
Topic relevance

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

Keep practising this topic