Examveda
Examveda

How many times will a 'do-while' loop execute its body if the condition is initially false in C?

A. 0 times

B. 1 time

C. Infinite times

D. It depends on the loop body

Answer: Option B

Solution(By Examveda Team)

In C, a do-while loop executes its body at least once, even if the condition is initially false. This is because the condition is evaluated after the body of the loop has been executed. If the condition is false after the first execution of the body, the loop terminates. Therefore, even if the condition is initially false, the loop body will execute once before the condition is evaluated.

So, the correct answer is Option B: 1 time.

This Question Belongs to C Program >> Control Structures

Join The Discussion

Comments ( 1 )

  1. Anusree K
    Anusree K :
    2 days ago

    i think the code will execute once

Related Questions on Control Structures