Loops & Control Structure in C
31. How many times letsfindcourse will be printed?
#include <stdio.h>
int main()
{
int i = -5;
while (i <= 5)
{
if (i >= 0)
break;
else
{
i += 1;
continue;
}
printf("letsfindcourse");
}
return 0;
}
View Answer
32. What is the output of this program?
#include <stdio.h>
void main()
{
int a = 3;
while (a--)
{
int a = 10;
a--;
printf("%d ", a);
}
}
View Answer
33. Which of the given statment is true about the given code ?
int main()
{
int i = 0;
for ( ; i < 5 ; )
{
if (i < 5)
printf("Hello", i++);
else
continue;
printf("World");
}
return 0;
}
View Answer
34. How many times value of j is checked in the below code ?
#include
View Answer
35. What is the output of the following code?
int main()
{
int i = 0;
switch(i)
{
case 0 : i++;
case 1 : i+++2;
case 2 : ++i;
}
pritnf("%d",i++);
return 0;
}
View Answer
36. How many x are printed?
for(i=0,j=10;i < j;i++,j--)
printf("x");
View Answer
37. How many x are printed?
for(i=-2,j=5;i < j;i++,j--)
printf("x");
View Answer
38. What will be the output of the program?
int a=0,b=2;
if(a=0) b=0;
else b*=10;
View Answer
39. What will be the output of the program?
int a=2,b=2;
if(a!=0)
b=0;
else
b*=10;
printf("%d",b);
View Answer
40. What will be the output of the program?
int a=2,b=2;
if(a && 0)
b=0;
else
b*=10;
printf("%d",b);
View Answer
Also check :