Control Structure Questions and Answers
Control Structure Questions with Answers form the foundation of logic building in C programming. These C programming questions and answers focus on decision-making statements like if-else, switch, loops, and nested conditions. Mastering control structures helps in writing efficient and optimized programs, which is crucial for placements at TCS, Infosys, and Accenture. Practicing control structure MCQs with solutions enables you to solve complex programming tasks confidently. Start your C aptitude preparation now by downloading our free control structure practice questions PDF or attempt the online test for immediate feedback.
Control Structure
Showing 10 of
97 questions
71. Find the output void main ( ) { int x=2; switch (x) { case 1:case 2:cse 3: printf("fool"); default: break; } }
- Fool
- No output
- Expression syntax
- None of these
72. Find the output void main ( ) { int i; for (i=0; i<10;i++ { switch (i) { case 0: i+=0; case 1: i+=1; case 2: i+=2; default: i+=3; break; } printf("%d", i); } }
- 0, 1, 3, 6, 7, 8
- 0, 1, 3
- 6, 10
- 5, 10
73. Find the output. void main ( ) { switch (0) { case '0': printf("Fool"); break; case '\0:' printf("Mad"); } }
- Fool
- Mad
- Compilation error
- None of these
74. Find the output void main ( ) { float f=0.9; double d=0.9f; if (f==d) printf("ar"); else printf("Near"); }
- Dear
- Near
- Compilation error
- None of these
75. Find the output void main ( ) { int x=4; char y=4; if (x==y) printf ("Equal"); else printf("Not equal"); }
- Equal
- Not equal
- Compilation error
- No output
76. Find the output void main ( ) { int ch='a; switch (ch) { case 'a': printf("%d", 'a'); case 97: printf("Foo1"); default: printf('Good"); }
- 97Fool
- Good
- Fool
- Compilation error
77. To execute al switch case statements
- Any one of the case statement match with switch condition
- First case must match with switch condition
- Default case must match with switch condition.
- None of these
78. Find the output void main ( ) { int c=12, d=15; while (c!=d) { if (c>d) c=c-d; else d=d=c; } printf("%d %d", c, d); }
- 30 30
- 3 3
- Compilation error
- None of these
79. Find the output void main ( ) { int a=20, b=15, c; c=func (a,b); printf ("%d", c); } int func (int a, int b) { if (a!=b) if (a<b) func (b,a); else func (b,a-b); else return a; }
- 20
- 15
- 5
- 10
80. Find the output void main ( ) { int a, b, c, d; a=b=c=5; if (d=(a==b)) if (d==c) printf("good"); else printf("Boy"); else printf ("Good boy"); }
- Good
- Boy
- Good boy
- Compilation error