Professional Documents
Culture Documents
error correction 3_ans
error correction 3_ans
error correction 3_ans
• 100
• Count12to18 + 1
• CountOver18
(b) One mark suitable IF construct, one mark correct assignment statement, for example
IF Age < 7
THEN
CountUnder7 ← CountUnder7 + 1
ENDIF
One mark suitable message, one mark correct use of countUnder7 variable, for example
OUTPUT "There are ", CountUnder7, " students aged under 7."
• Line 1 100
• Line 11 Reading[Value] + 1
• Line 18 Reading[Count]
• Line 19 Count – 1
Corrected algorithm
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] Mark
10 HighList HighList + 1
11 ELSE
12 IF Mark >= 50
13 THEN
14 Middle[MidList] Mark
15 MidList MidList + 1
16 ELSE
17 Lower[LowList] Mark
18 LowList LowList + 1
19 ENDIF
20 ENDIF
21 MarksEntry MarksEntry + 1
5. One mark per mark point in the correct position, max six
• line 01 50
• line 12 Reading[Value] + 1
• line 23 Reading[Count]
• line 24 Count + 1
Line 10 / Exit
should be Exit
0 // should be Exit
Line 13 / ENDIF
should be ENDWHILE
01 Exit 1
03 INPUT Number
04 IF Number > 0
05 THEN
07 ELSE
08 IF Number = 0
09 THEN
10 Exit 0
11 ENDIF
12 ENDIF
13 ENDWHILE
REPEAT
INPUT Number[Counter]
should be Counter 0
Line 09 / ENDCASE
should be ENDIF
Correct algorithm
01 Counter 0
02 Total 0
04 INPUT Number
05 IF Number > 0
06 THEN
08 Counter Counter + 1
09 ENDIF
10 ENDWHILE
• INPUT Number is missing from inside the loop, insert INPUT Number after the ENDIF statement.
11. One mark for each error identified plus suggested correction (the corrected lines must be written in
full).
Correct lines: