Loops
1.
What is the final value of x when the code int x; for(x=0; x<10; x++) {} is run ?
2.
What is the final value of x when the code int x; for(x=0; x<10; x++) {} is run ?
3.
When does the code block following while(x<100) execute ?
4.
Which is not a loop structure ?
5.
How many times is a do while loop guaranteed to loop ?
6.
How many loops are there in C++ 98 ?
7.
What is currect syntax of for loop ?
8.
How many times CppBuzz.com is printed ?
int main()
{
int i=0;
lbl:
cout<<"CppBuzz.com";
i++;
if(i<5)
{
goto lbl;
}
return 0;
}
9.
Can a for loop contain another for loop ?
10.
Find the output of below program:-
int main()
{
int i = 0, x = 0;
do
{
if(i % 5 == 0)
{
cout<<x;
x++;
}
++i;
}while(i<10);
cout<<x;
return 0;
}