Question 4(c) 2024 · May-June · Paper 21 · 4 marks
Reveal official mark-scheme answer
Official answer for Question 4
Part (c)
Question 4
Show text version of question
Question 4
Part (c)
Question 4
This pseudocode algorithm is intended to allow, at random, between 1 and 20 values to be entered
and totalled. The total and average of the entered values are output at the end of the algorithm.
01 DECLARE Loop : STRING 02 DECLARE Limit : INTEGER 03 DECLARE Value : REAL 04 DECLARE Total : REAL 05 Total 0 06 Limit ROUND(RANDOM() * 19,0) + 1 07 IF Loop 1 TO Limit 08 OUTPUT "Enter a number" 09 INPUT Loop 10 Total Total * Value 11 NEXT Loop 12 OUTPUT "The total of the numbers entered is ", Total 13 OUTPUT "The average of the numbers entered is ", Total / Limit
Part (c)
Explain how you should alter the original corrected algorithm to make sure that all the
numbers entered are between 1 and 500 inclusive. If any numbers fall outside these limits, a replacement value is requested and entered.
You do not need to re-write the algorithm.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................
Why this question appears here
99% 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 2210_s24_qp_21.pdf
