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.
- (a)Write an algorithm in pseudocode to total the numbers input and to output the total. You do not need to validate the input.[4]
- (b)Write an algorithm in pseudocode to count and output the number of input values that are greater than 100. You do not need to validate the input.[4]
Mark scheme
Marking points from the official mark scheme (May/June 2024). The mark or mark type is shown in brackets.
- 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
- 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
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →