Note AcademyNote Academy

Computer Science · May / June 2022 · Paper 21 · Question 4

0478

As printed in the paper

The question as text

The flowchart shows an algorithm that should allow 60 test results to be entered into the variable Score. Each test result is checked to see if it is 50 or more. If it is, the test result is assigned to the Pass array. Otherwise, it is assigned to the Fail array.

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

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

    One mark per mark point, max six

    MP1

    input box

    MP2

    correct check of Score

    MP3

    assign Score to Pass correctly

    MP4

    assign Score to Fail correctly

    MP5

    increment both array counters

    MP6

    correct check of number of scores

    START

    PassCount ← 0

    FailCount ← 0

    Count ← 0

    INPUT

    Score

    Yes

    No

    IS Score >=

    50?

    Pass[PassCount] ← Score

    Fail[FailCount] ← Score

    PassCount ← PassCount + 1

    FailCount ← FailCount + 1

    Count ← Count + 1

    No

    IS Count =

    60?

    Yes

    END

  • 4(b)[4]

    One mark per mark point, max four

    MP1

    appropriate conditional loop structure

    MP2

    correct identification of invalid input

    MP3

    appropriate error message

    MP4

    repeated input of score until correct

    WHILE Score < 0 OR Score > 100 (DO)

    OUTPUT "Your entry must be between 0 and 100, inclusive, please try again "

    INPUT Score

    ENDWHILE

    Or:

    REPEAT

    IF Score < 0 OR Score > 100

    THEN

    OUTPUT "Your entry must be between 0 and 100, inclusive, please try again " INPUT Score

    ENDIF

    UNTIL Score >= 0 AND Score <= 100

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