KnowledgeBoat Logo

Computer Applications

Which of the following are entry controlled loops?

(a) for

(b) while

(c) do..while

(d) switch

  1. only a
  2. a and b
  3. a and c
  4. c and d

Java Iterative Stmts

ICSE 2024

3 Likes

Answer

a and b

Reason — An entry-controlled loop checks the loop condition before executing the loop's body. If the condition is false at the start, the loop's body will not execute even once.
for and while loops check the condition before running the loop's body. If the condition is false, the loop won't run. Therefore, they are entry controlled loops.
The body of the do-while loop executes at least once before checking the condition. Hence, it is an exit controlled loop.

Answered By

2 Likes


Related Questions