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

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

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

Official answer for Question 5

Part (b)

✓
One mark per mark point, max four

Question 4

✓
Initialise a new (counting) variable
✓
… Count 0 // to count the acceptable numbers
✓
Insert a counting statement between lines 05 and 07
✓
… Count Count + 1
✓
Add a new output after the loop/after line 13 / at the end (of the program)
✓
… OUTPUT Count
✓
Question
✓
Answer
✓
Marks

Mark scheme 0478_s23_ms_21.pdf →

Show text version of question

Question 5

Part (b)

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 (b)

Describe how you could change the corrected algorithm to record and output how many

positive numbers have been included in the final total.

You do not need to rewrite the algorithm.

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

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

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

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

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

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

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

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

[4]
Topic relevance

Why this question appears here

56% assigned-topic match · Programming › Programming concepts

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