Past-paper question · 2023 May-June · Paper 21 · Q5(a)

Question 5(a) 2023 · May-June · Paper 21 · 4 marks

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

Official answer for Question 5

Part (a)

✓
One mark per mark point, max four

Question 4

✓
Line 04 / IF Number < 0
✓
should be IF Number > 0
✓
Line 10 / Exit 1 // Line 01/ Exit 1 and Line 02 / WHILE Exit <> 0
✓
should be Exit 0 // should be Exit 0 and WHILE Exit = 0
✓
Line 13 / ENDIF
✓
should be ENDWHILE
✓
Line 14 / OUTPUT "The total value of your numbers is ", Number
✓
should be OUTPUT "The total value of your numbers is ", Total
✓
Correct algorithm:
✓
Exit 1
✓
01
✓
02
✓
WHILE Exit <> 0 DO
✓
03
✓
INPUT Number
✓
04
✓
IF Number > 0
✓
05
✓
THEN
✓
Total Total + Number
✓
06
✓
07
✓
ELSE
✓
08
✓
IF Number = 0
✓
09
✓
THEN
✓
Exit 0

Question 10

Question 11

✓
ENDIF

Question 12

✓
ENDIF

Question 13

✓
ENDWHILE

Question 14

✓
OUTPUT "The total value of your numbers is ", Total
✓
0478/21
✓
Cambridge IGCSE – Mark Scheme
✓
May/June 2023
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 0478_s23_ms_21.pdf →

Show text version of question

Question 5

Part (a)

Question 5

An algorithm has been written in pseudocode to allow some numbers to be input. All the positive

numbers that are input are totalled and this total is output at the end. An input of 0 stops the algorithm.

01 Exit 1← 02 WHILE Exit <> 0 DO 03 INPUT Number 04 IF Number < 0 05 THEN 06 Total ← Total + Number 07 ELSE 08 IF Number = 0 09 THEN 10 Exit 1 ← 11 ENDIF 12 ENDIF 13 ENDIF 14 OUTPUT "The total value of your numbers is ", Number

Part (a)

Identify the four errors in the pseudocode and suggest a correction for each error.

Error 1 .......................................................................................................................................

Correction .................................................................................................................................

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

Error 2 .......................................................................................................................................

Correction .................................................................................................................................

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

Error 3 .......................................................................................................................................

Correction .................................................................................................................................

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

Error 4 .......................................................................................................................................

Correction .................................................................................................................................

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

[4]

Question 5

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

Keep practising this topic