Past-paper question · 2024 May-June · Paper 21 · Q4(a)

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

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

Official answer for Question 4

Part (a)

✓
One mark per mark point

Question 4

✓
Line 01 / DECLARE Loop : STRING
✓
should be DECLARE Loop : INTEGER
✓
Line 07 / IF Loop 1 TO Limit
✓
should be FOR Loop 1 TO Limit
✓
Line 09 / INPUT Loop
✓
should be INPUT Value
✓
Line 10 / Total Total * Value
✓
should be Total Total + Value
✓
Correct algorithm:
✓
01
✓
DECLARE Loop : INTEGER
✓
02
✓
DECLARE Limit : INTEGER
✓
03
✓
DECLARE Value : REAL
✓
04
✓
DECLARE Total : REAL
✓
Total 0
✓
05
✓
Limit ROUND(RANDOM() * 19,0) + 1
✓
06
✓
FOR Loop 1 TO Limit
✓
07
✓
08
✓
OUTPUT "Enter a number"
✓
09
✓
INPUT Value
✓
Total Total + Value

Question 10

Question 11

✓
NEXT Loop

Question 12

✓
OUTPUT "The total of the numbers entered is ", Total

Question 13

✓
OUTPUT "The average number entered is ", Total / Limit
✓
2210/21
✓
Cambridge O Level – Mark Scheme
✓
May/June 2024
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 2210_s24_ms_21.pdf →

Show text version of question

Question 4

Part (a)

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

Identify the line numbers of four errors in the pseudocode and suggest corrections.

Error 1 line number ...................................................................................................................

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

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

Error 2 line number ...................................................................................................................

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

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

Error 3 line number ...................................................................................................................

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

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

Error 4 line number ...................................................................................................................

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

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

[4]
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 2210_s24_qp_21.pdf

Keep practising this topic