Which of the following statements best describes the functionality of a for…

2025

Which of the following statements best describes the functionality of a for loop in programming?

  1. A.

    It initialises, checks condition, and updates control variable in a single line.

  2. B.

    It continuously executes without checking any condition.

  3. C.

    It allows conditional execution only after running the loop body once.

  4. D.

    It can only be used when the number of iterations is unknown.

Attempted by 104 students.

Show answer & explanation

Correct answer: A

A standard for loop is specifically designed to bring structure and readability to counter-controlled loops. In languages like C, C++, Java, and JavaScript, the loop header contains three distinct parts separated by semicolons, all packed into a single line:

  1. Initialization: Sets up the starting value of the loop control variable (e.g., int i = 0).

  2. Condition: Tested before every iteration; the loop keeps running as long as this remains true (e.g., i < 10).

  3. Update: Modifies the control variable after each run of the loop body (e.g., i++).

Explore the full course: Rssb Senior Computer Instructor