1.

Observe the given code:int ctr=10;while(ctr>5){ctr=ctr-2;}Attempt the following questions based on the above given code:(i) How many times the above given loop will run and what will be the value of ctr, immediately after exiting from the loop.(ii) Out of entry controlled or exit controlled loop, above given loop will come under which category and why?

Answer»

(i) 3 times

4

(ii) Above given loop will come under Entry controlled loop as in the above given loop condition is being checked at the time of entering in the loop.



Discussion

No Comment Found

Related InterviewSolutions