Note AcademyNote Academy

Computer Science · Oct / Nov 2020 · Paper 22 · Question 4

0478

As printed in the paper

The question as text

This pseudocode algorithm allows 5000 numbers to be entered and stored in an array called Number. FOR Count 1 TO 5000 INPUT Number[Count] NEXT Count Extend and re-write the algorithm using pseudocode to also count and output how many of the numbers stored in the array are greater than 500, using the variable Higher. Only output Higher once with an appropriate message. [6]

Read automatically from the paper; the printed page above is exact.

Show the answer and mark scheme

Any six from:

MP1

Initialisation of Higher to 0 before the loop

MP2

Use of IF statement

MP3

Correct condition in IF statement

MP4

Correct counting statement inside loop

MP5

OUTPUT/PRINT statement with correct reference to Higher MP6

Appropriate message in output

MP7

Correct location of OUTPUT and IF statements

Higher ← 0

FOR Count ← 1 TO 5000

INPUT Number[Count]

IF Number[Count] > 500

THEN

Higher ← Higher + 1

ENDIF

NEXT Count

OUTPUT "There are ", Higher, " values that are greater than 500"

Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.