Contents

What is the output of following?
int n=4; do{n=n*3;}
while(n<=100)
a) 108   
b) 110   
c) 107    
d) 100

a

What is the output of following code?
int 
n=8; for (int i=1; i<=n*3; i++)   n++;
a) infinite loop   
b) 9
c) 12                                      
d) 16

a

What is the output of following code?
int n=4; for (int i=n; i>=0; i--)   n- =I;
a) -6       
b) 5                        
c) -7                       
d) -5

a

What is the output of following?
int n=5; while(n<=20)
if(n%2) n=n-1
else n=n+3
a) 21      
b) 20                      
c) 19                      
d) 22

a

What is the output of following code?
int x=-1, y=0;
while(x<=3) {y=y+2; x=x+1;}
a) 10      
b) 11                      
c) 9                        
d) 8

a

What is the output of following code?
int n=0; for (int m=0; m<10; m++)
n+=m++;
a) 20      
b) 21                      
c) 22                      
d) 18

a