Note AcademyNote Academy

Computer Science · May / June 2024 · Paper 22 · Question 6

0478

As printed in the paper

The question as text

Totalling and counting are standard methods of solution. Numbers are input. The number 9999.9 is the last number to be input and is ignored.

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

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

    One mark for:

    MP1

    adding current value to total

    One mark for each point max three.

    MP2

    input more than one number

    MP3

    setting total to zero before loop

    MP4

    correct use of loop including terminal condition

    MP5

    output total after loop

    Example:

    Total ← 0

    INPUT Value

    WHILE Value <> 9999.9

    Total ← Total + Value

    INPUT Value

    ENDWHILE

    OUTPUT Total

    Value ← 0

    Total ← 0

    REPEAT

    Total ← Total + Value

    INPUT Value

    UNTIL Value = 9999.9

    OUTPUT Total

  • 6(b)[4]

    One mark for each point

    MP1

    adding one to counter

    MP2

    correct use of selection, if current value > 100 THEN … ENDIF

    One mark for each point, max two

    MP3

    input more than one number

    MP4

    setting counter to zero before loop

    MP5

    correct use of loop including terminal condition

    MP6

    output value of counter after loop

    Example:

    Counter ← 0

    INPUT Value

    WHILE Value <> 9999.9

    IF Value > 100

    THEN

    Counter ← Counter + 1

    ENDIF

    INPUT Value

    ENDWHILE

    OUTPUT Counter

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