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
21. Find the output void main ( ) { int a=5, b=3, c=2; if (a>b>c) printf("LINUX"); else printf("WINDOWS"); }
- WINDOWS
- LINUX
- Error: Multiple conditions not allowed in if statement
- None of these
22. Find the output void main ( ) { int x=5, y=3; if (x>y) printf("HOT"); else; printf("COLD"); }
- HOT
- COLD
- HOTCOLD
- Compilation error
23. Find the output. void main ( ) { int a=1; if (a==2)return printf("C Program"); }
- No Output
- C Program
- Compile time Error
- Run time Error
24. Which of the following statements causes unconditonal execution
- Only break
- Both break and continue
- There is no unconditional execution in C
- goto
25. Find the output void main ( ) { if (printf("bc"), printf("a"), printf("bc")) printf("hai"); else printf("byte"); }
- bchai
- bcbye
- bcabc
- bcabchai
26. Which of the following switch statement is true? I. int a=1, b=2, c=3, x; switch (x) { switch (x>2) { case 1: case a: case 2: case b: case 3: case c: } } II. int x=5; III. int x=2; switch (x<B) { switch (x>1) { case 1: swtich (5) { case 2: continue; case 1: case 3: case 2: } } }
- Only I
- Both I & II
- Both I & II
- None of these
27. Find the output void main ( ) { float x=3.y; double y=1.5; if (x && y>1.5) printf("fool"); else printf("stupid"); }
- fool
- stupid
- Garbage value
- None of these
28. Find the output int a=50, b=60, c=70; if (! (a=15)>b) b=100; else c=100;
- 60 100
- 100 70
- 60 0
- 60 70
29. Fint the output void main ( ) { int x=5; if (x=1) printf("one"); else printf("five"); printf("%d",x); }
- one5
- five5
- one1
- five1
30. Find the output. void main ( ) { int i=2; switch (i>>1) { default: i++; case 1:; case 2:; } printf("%d",i); }
- 2
- 1
- Compilation error
- None of these