Important MCQ

Forgetting i++ inside a while loop usually causes

Q.Forgetting i++ inside a while loop usually causes

A) no output
B) a faster program
C) a header error
D) an infinite loop
Correct Answer:
Option D
Detailed Explanation:
D) an infinite loop is correct. A while loop checks its condition before each iteration, so it may run zero times. The loop body must update state when needed to avoid an unintended infinite loop.