An algorithm has been written in pseudocode to input 100 numbers and print out the sum. A REPEAT ... UNTIL loop has been used. `Count ← 0` `Sum ← 0` `REPEAT` `INPUT Number` `Sum ← Sum + Number` `Count ← Count + 1` `UNTIL Count > 100` `PRINT Sum`
- (a)Find the error in the pseudocode and suggest a correction. Error. Correction[2]
- (b)Rewrite the correct algorithm using a more suitable loop structure.[3]
Mark scheme
Marking points from the official mark scheme (May/June 2017). The mark or mark type is shown in brackets.
- [1] Error Count ← 0 // Correction Count ← 1
- [1] Error UNTIL Count > 100 // Correction UNTIL Count >= 100 or UNTIL Count = 100 or UNTIL Count > 99
- [1] use of FOR with correct start and end values
- [1] use of NEXT
- [1] removal of increment for Count
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 →