41. What will be the output of given program?
#include<stdio.h>
void main()
{
int a=1;
if("%d=hello", a);
}
#include<stdio.h>
void main()
{
int a=1;
if("%d=hello", a);
}
42. What will be the output of given program?
#include<stdio.h>
void main()
{
int a=3;
for(;a;printf("%d ", a--);
}
#include<stdio.h>
void main()
{
int a=3;
for(;a;printf("%d ", a--);
}
43. What will be the output of given program?
#include<stdio.h>
void main()
{
int i=1, j=-1;
if((printf("%d", i)) < (printf("%d", j)))
printf("%d", i);
else
printf("%d", j);
}
#include<stdio.h>
void main()
{
int i=1, j=-1;
if((printf("%d", i)) < (printf("%d", j)))
printf("%d", i);
else
printf("%d", j);
}
44. What will be the output of the following piece of code?
for(i = 0; i<10; i++);
printf("%d", i);
for(i = 0; i<10; i++);
printf("%d", i);
45. What will be the output of the following code?
#include<stdio.h>
void main()
{
int s=0;
while(s++<10)
{
if(s<4 && s<9)
continue;
printf("%dt", s);
}
}
#include<stdio.h>
void main()
{
int s=0;
while(s++<10)
{
if(s<4 && s<9)
continue;
printf("%dt", s);
}
}
46. Which command is used to skip the rest of a loop and carry on from the top of the loop again?
47. What is the output of the following program?
#include<stdio.h>
int c[10] = {1,2,3,4,5,6,7,8,9,10};
main()
{
int a, b=0;
for(a=0;a<10;++a)
if(c[a]%2 == 1)
b+=c[a];
printf("%d", b);
}
#include<stdio.h>
int c[10] = {1,2,3,4,5,6,7,8,9,10};
main()
{
int a, b=0;
for(a=0;a<10;++a)
if(c[a]%2 == 1)
b+=c[a];
printf("%d", b);
}
48. What is the output of the following statements?
for(i=10; i++; i<15)
printf("%d ", i);
for(i=10; i++; i<15)
printf("%d ", i);
49. The type of the controlling expression of a switch statement cannot be of the type ........
50. What's wrong in the following statement, provided k is a variable of type int?
for(k = 2, k <=12, k++)
for(k = 2, k <=12, k++)
Read More Section(Control Structures)
Each Section contains maximum 100 MCQs question on Control Structures. To get more questions visit other sections.