Multiple choice technology programming languages

Which of the following errors are possible within a COBOL IF statement?

  1. Infinite loop

  2. logical error

  3. runtime error

  4. All of the above

Reveal answer Fill a bubble to check yourself
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.