Professional Documents
Culture Documents
int i = 1 ;
i=i-1;
while(i)
{
cout<<"its a while loop";
i++ ;
}
A. 1
B. 2
C. 0
D. Infinite times
ANSWER: C
2- How many times 'its a while loop' should be printed?
int i = 1 ;
i=i-1;
while(i)
{
cout<<"its a while loop";
i++ ;
}
E. 1
F. 2
G. 0
H. Infinite times
ANSWER: C
ANSWER: D
Which looping process checks the test condition at the end of the loop?
A. for .
B. while .
C. do-while .
D. no looping process checks the test condition at the end .
ANSWER: C
If there is more than one statement in the block of a for loop, which of the following must be
placed at the beginning and the ending of the loop block?
A. parentheses ( )
B. braces { }
C. brackets [ ]
D. arrows < >
ANSWER: B
What would be the output from the following C++ code segment?
x=10;
while(x>5){
cout<<x<<"\t";
x--;
}
A. 10 9 8 7 6
B. 10 9 8 7 6 5
C. 1098765
D. 109876
ANSWER: A