Which of the following errors are possible within a COBOL IF statement?
-
Infinite loop
-
logical error
-
runtime error
-
All of the above
D
Correct answer
Explanation
All three error types are possible in a COBOL IF statement. Logical errors occur when the condition or logic is incorrect (e.g., wrong operator). Runtime errors can happen if a variable in the condition is uninitialized or has invalid data. Infinite loops can occur if an IF within a PERFORM loop or other looping construct never allows exit due to flawed logic. Therefore 'All of the above' is correct as each represents a valid category of error.