C Programming Multiple Choice Question - Structure And Loops
This section focuses on the "Structure And Loops" of the C programming. These Multiple Choice Questions (mcq) should be practiced to improve the C programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. In the following loop construct, which one is executed only once always.    for(exp1; exp2; exp3)
View Answer
2. The continue statment cannot be used with
View Answer
3. Which keyword can be used for coming out of recursion?
View Answer
4. goto can be used to jump from main to within a function?
View Answer
5. Which of the following is an invalid if-else statement?
View Answer
6. Switch statement accepts.
View Answer
7. Which loop is guaranteed to execute at least one time.
View Answer
8. A labeled statement consist of an identifier followed by
View Answer
9. do-while loop terminates when conditional expression returns?
View Answer
10. c = (n) ? a : b; can be rewritten asexp1 ? exp2 : exp3;
View Answer
11. For loop in a C program, if the condition is missing?
View Answer
12. Which of the following statement about for loop is true ?
View Answer
13. Using goto inside for loop is equivalent to using
View Answer
14. If switch feature is used, then
View Answer
15. Which of the following comments about for loop are correct ?
View Answer
16. In the context of "break" and "continue" statements in C, pick the best statement.
View Answer
17. In _______, the bodies of the two loops are merged together to form a single loop provided that they do not make any references to each other.
View Answer
18. What is the output of this program?
void main()
{
if(!printf(""))
printf("hello");
else
printf("world");
}
View Answer
19. What is the output of this program?
#include <stdio.h>
void main()
{
int a=10;
if(a=5)
printf("YES");
else
printf("NO");
}
View Answer
20. What is correct about the given program?
#include <stdio.h>
int x;
void main()
{
if (x);
else
printf("Else");
}
View Answer
21. What is the output of this program?
#include <stdio.h>
int main()
{
int a = 5;
if (a == 6); a = 0;
if (a == 5)
a++;
else a += 2;
printf("%d", a);
return 0;
}
View Answer
22. What is the output of this program?
#include <stdio.h>
int main()
{
int a = 1, b = 0;
int c = (a++, b++) ? b : a;
printf("%d", c);
return 0;
}
View Answer
23. What is the output of this program?
int main()
{
int a = 1, b = 0;
int c = a%2 ? a++ : a-- ? a=0 : ++b ? b = 2 : b++ ;
printf("%d", c);
return 0;
}
View Answer
24. What will be the output of the program in 16 bit platform ?
#include <stdio.h>
int main()
{
int a=2, b=1, c=2;
switch(a)
{
case b:
printf("You are in b ");
break;
case c:
printf("You are in c ");
break;
default:printf("You are in default");
}
return 0;
}
View Answer
25. What will be output when you will execute following c code?
#include <stdio.h>
int main()
{
int a=2;
switch(a,a+1)
{
case 2:
printf("You are in b ");
break;
case 3:
printf("You are in c ");
break;
default:
printf("You are in default");
}
return 0;
}
View Answer
26. What is the output of this program?
#include <stdio.h>
void main() {
float a = 0.7;
if ( a < 0.7 )
printf( "Yes" );
else
printf( "No" );
}
View Answer
27. What is the output of this program?
#include <stdio.h>
void main()
{ char a=0;
for(a=0;a<=127;a++)
{
printf("%d ",a);
}
}
View Answer
28. How many times the loop will execute ?
for(int i = 0 ; i < 10 ; i++)
{
i = i*2;
i--;
}
View Answer
29. What is the output of this program?
#include <stdio.h>
void main()
{
int j = -5;
for(;j;printf("%d ", j++));
}
View Answer
30. What is the output of this program?
void main()
{
int x=0;
for(;;)
{
if(x==3)
break;
printf("%d ",++x);
}
}
View Answer
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 :
Discussion