Question 1: Syntax Error
The following pseudocode is intended to display a student’s name.
1 DECLARE Name : STRING
2 INPUT Name
3 IF Name = “Ali”
4 OUTPUT “Welcome Ali”
5 ENDIF
Task:
- (a) Identify the type of error in the pseudocode
- (b) State the line number where the error occurs
- (c) Write the corrected line of code
Question 2: Logic Error
The following pseudocode checks whether a number is a pass or fail.
1 DECLARE Mark : INTEGER
2 INPUT Mark
3 IF Mark > 50 THEN
4 OUTPUT “Pass”
5 ELSE
6 OUTPUT “Fail”
7 ENDIF
A mark of 50 should also be considered a pass.
Task:
- (a) Identify the type of error
- (b) State the line number where the error occurs
- (c) Correct the error
Question 3: Runtime Error
The following pseudocode calculates the average of two numbers.
1 DECLARE Total, Count, Average : INTEGER
2 INPUT Total
3 INPUT Count
4 Average ← Total / Count
5 OUTPUT Average
Task:
- (a) Identify the possible error that may occur
- (b) State the line number where the error occurs
- (c) Write a correction to prevent this error
Question 4: Syntax Error (Missing Keyword)
The following pseudocode checks if a number is positive.
1 DECLARE Num : INTEGER
2 INPUT Num
3 IF Num > 0
4 OUTPUT “Positive Number”
5 ENDIF
Task:
- (a) Identify the type of error
- (b) State the line number
- (c) Correct the error
Question 5: Logic Error (Wrong Condition)
The following pseudocode is meant to display “Child” if age is less than 18.
1 DECLARE Age : INTEGER
2 INPUT Age
3 IF Age > 18 THEN
4 OUTPUT “Child”
5 ELSE
6 OUTPUT “Adult”
7 ENDIF
Task:
- (a) Identify the type of error
- (b) State the line number where the error occurs
- (c) Write the correct condition
Exam Tip for Students
In 2210 exams, always:
- Name the error type
- Mention the exact line number
- Write the corrected pseudocode line
