Contents

In which sequence while loop is executed
a) body, initialization, testing           
b) testing, initialization, body
c) initialization, testing, body         
d) initialization body, testing

c

A while loop is more appropriate than for loop…..
a) body executed only once             
b) termination condition occurs unexpectedly
c) program executes at least once   
d) number of iterations are known

b

Which condition does…. while loop is more appropriate to use?
a) body of loop executed only once              
b) loop terminates unexpectedly
c) program executes only once        
d) number of iterations is known

a

Which condition for loop is more appropriate?
a) loop executes at least once                          
b) loop terminates unexpectedly
c) program executes at least once
d) iteration is known

d

A loop exit condition must….
a) be last instruction in body                            
b) evaluate to true or false
c) first instruction in body 
d) not use compound condition

b

What is missing in the following code?
int loopCount;
while(loopCount<=5) {cout<<” Hi”;}
a) initialization of loop    
b) testing of loop
c) incrementing of loop     
d) nothing is missing

a