Important MCQ

A for loop is best when

Q.A for loop is best when

A) the body must run zero times
B) the repetitions are unknown
C) no loop is needed
D) the number of repetitions is known
Correct Answer:
Option D
Detailed Explanation:
D) the number of repetitions is known is correct. A for loop has initialization, condition, and update parts separated by semicolons. Initialization runs once; the condition controls repetition and the update changes the loop variable.