This pseudocode should allow 500 marks to be entered into the algorithm. If the mark is 80 or greater it is stored in an array for higher marks. If the mark is less than 80, but greater than or equal to 50 it is stored in an array for middle marks. The remaining marks are stored in an array for lower marks. The results from the algorithm are displayed at the end. 01 HighList ← 0 02 MidList ← 0 03 LowList ← 0 04 MarksEntry ← 0 05 REPEAT 06 INPUT Mark 07 IF Mark >= 80 08 THEN 09 Higher [HighList] ← MarksEntry 10 HighList ← HighList + 1 11 ELSE 12 IF Mark >= 50 13 THEN 14 Middle [MidList] ← Mark 15 MidList ← MidList 16 ELSE 17 Lower [HighList] ← Mark 18 LowList ← LowList + 1 19 ENDIF 20 ENDIF 21 MarksEntry ← MarksEntry + 1 22 NEXT MarksEntry = 500 23 OUTPUT "You entered ", HighList, " higher marks" 24 OUTPUT "You entered ", MidList, " middle marks" 25 OUTPUT "You entered ", LowList, " lower marks"
- (a)Identify the four errors in the pseudocode and suggest a correction for each error. Error 1 ........................................................................................................................................... Correction ..................................................................................................................................... Error 2 ........................................................................................................................................... Correction ..................................................................................................................................... Error 3 ........................................................................................................................................... Correction ..................................................................................................................................... Error 4 ........................................................................................................................................... Correction .....................................................................................................................................[4]
- (b)The corrected algorithm needs to be changed so that any number of marks may be entered and the algorithm runs until the user tells it to stop. Write the new pseudocode statements that would be needed to achieve this and state where in the algorithm they would be placed.[4]
Mark scheme
Marking points from the official mark scheme (Oct/Nov 2022). The mark or mark type is shown in brackets.
- [1] Line 09 / Higher[HighList] ← MarksEntry should be Higher[HighList] ← Mark
- [1] Line 15 / MidList ← MidList should be MidList ← MidList + 1
- [1] Line 17 / Lower[HighList] ← Mark should be Lower[LowList] ← Mark
- [1] Line 22 / NEXT MarksEntry = 500 should be UNTIL MarksEntry = 500
- [1] MP1 Set up a condition to end the input
- [1] MP2 The correct placement of the condition
- [1] MP3 Set up the test
- [1] MP4 The correct placement of the test
- [1] MP5 Removal of MarksEntry counter from the original algorithm
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 →