Note AcademyNote Academy

Computer Science · May / June 2025 · Paper 22 · Question 7

0478

As printed in the paper

The question as text

The flowchart shows an algorithm that is used to input 50 numbers. Each number is stored in the variable ¾©„‡ when it is input. Any number input that is less than or equal to –20 or greater than or equal to 50 is rejected and re-input. The accepted numbers are added together as they are entered and the total and average of these numbers are output at the end of the algorithm.

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

Show the answer and mark scheme
  • 7(a)[6]

    One mark per mark point, max six

    MP1 input Value

    MP2 correct check that Value is

    between −20 and 50,

    exclusive

    MP3 totalling values

    MP4 counting number of values

    MP5 checking Count = 50 / >= 50

    MP6 output of total and average

    START

    Count ← 0

    Total ← 0

    INPUT Value

    IS Value <=

    No

    Yes Total ← Total + Value

    –20 OR Value

    >= 50 ?

    IS Count = 50

    No Count ← Count + 1

    Yes

    OUTPUT Total

    OUTPUT Total/50

    STOP

  • 7(b)[4]

    One mark per statement

    MP1 Change INPUT Value so that it saves values into an array

    MP2 … using the counter as the index

    MP3 Outside the (first) loop, set up a loop that will iterate 50 times MP4 Use an output statement inside the (second) loop to output the contents of the array, using the counter as the index.

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