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
61. Find the output void main ( ) { int a,b,c=4; if (a=c%2) b=5; printf("%d", b); }
- 5
- 0
- No output
- Garbage value
62. Find the output void main ( ) { char a='A'; if ((a=='z') | | ((a='L') && (sizeof (a='\0')))) a=a; printf("%c", a); printf("Nothing"); }
- A Nothing
- Nothing
- L Nothing
- Z Nothing
63. switch statement only tests for
- Relational expression
- Logical expression
- Equality
- All the above
64. Find the output. voidmain ( ) { int x=1; if (x++>=x) printf("%d",x); else printf("%d", ++x) }
- 2
- 3
- Compilation error
- None of these
65. Find the output void main ( ) { int i, j; for (i=1, j=5; i++, j--;) { if (i==j) continue; printf("%d", i); } }
- 2 4 5 6
- 1 2 4 5
- Compilation error
- None of these
66. Which is true about break statement?
- break can make early exit from the block where it appears.
- break can't be used in 'if' construct
- Both a and b
- None of these
67. Find the output void main ( ) { char c='\b'; if (c==8) printf("true"); else printf("false"); }
- true
- false
- Compilation error
- No output
68. Find the output void main ( ) { char ch; if("printf(")") printf("ok"); else printf("Bye"); }
- Ok
- Bye
- 0Ok
- 0Bye
69. Find the output void main ( ) int x=1, y=3, z=0; if (x!=y>=z) printf("Right"); else printf("Wrong"); }
- Right
- Wrong
- compilation error
- None of these
70. Find the output void main ( ) { int a=4, b=8, c=3; if (a+b!c) printf("True"); else printf("False"); }
- True
- False
- Compilation error
- None of these