Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

1.

Line 3 – should be FullScore ← 0

Line 7 – should be FullScore ← FullScore + Score

Line 8 – should be NEXT Allow ENDFOR // alternatively Line 5 could be REPEAT with StoreLoop ← 0
just above

it and StoreLoop ← StoreLoop + 1 between lines 7 and 8.

Line 11 – should be INPUT Another

Correct Algorithm 1

1 Count ← 0

2 REPEAT

3 FullScore ← 0

4 INPUT Number

5 FOR StoreLoop ← 1 TO Number

6 INPUT Score

7 FullScore ← FullScore + Score

8 NEXT

9 OUTPUT "The full score is ", FullScore

10 OUTPUT "Another set of scores (Y or N)?"

11 INPUT Another

12 IF Another = "N"

13 THEN

14 Count ← 1

15 ENDIF

16 UNTIL Count = 1

2. Line 2 and Line 4 errors - One mark for each correct identification and correction of error

Error 1 line number: Line 2

Correction: REPEAT

Error 2 line number: Line 4

Correction: IF Number < 0 OR Number > 499


Line 8 error - One mark for correct identification of error and one mark for each correction of error

Error 2 line number: Line 8

Correction: UNTIL Number >= 0 AND Number <= 499

3. One mark for error and correction

Line 1 HighestMark ← 0

Line 7 INPUT Mark[Count]

Line 10 HighestMarkStudents ← HighestMarkStudents + 1

Line 14 HighestMark ← Mark[Count]

4.

Line 8 OUTPUT Value2 – should be INPUT Value2

Line 9 IF Operator – should be CASE OF Operator

Line 15 OUTPUT "The answer is ", Value1 – should be Answer

Line 1 Continue ← 1 should be Continue ← 0

Line 22 UNTIL Continue = 0 should be ENDWHILE // Line 2 WHILE Continue = 0 should be REPEAT and
Line 22 UNTIL Continue = 0 should be Until Continue = 1

5. Line 1 should be Counter ← 0

Line 3 RandNum[Counter] ← Rand(1, 100)should be RandNum[Counter] ← Rand(1, 101)

Line 4 Counter ← Counter + 2 should be Counter ← Counter + 1

Line 5 UNTIL Count <= 50 should be UNTIL Counter >= 50 // UNTIL Counter = 50

You might also like