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 types of errors can occur within a COBOL IF statement. An infinite loop can result if the IF condition never becomes false and controls a loop structure. A logical error occurs when the condition is incorrectly specified, causing the program to take the wrong branch. A runtime error can happen if the IF statement involves invalid data operations like division by zero or invalid type comparisons. The IF statement's logic must be carefully designed to avoid all these error types.