Control Structure Questions and Answers

Take Exam

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

11. Find the output void main ( ) char x='A'; switch (x) { if (x==A) { printf("tomtom"); } else { printf("tom") default:printf("harry"); } } }

  • tomtom
  • harry
  • tomharry
  • Compilation error
Show Answer Report

12. Find the output void main ( ) { if (printf("hello"); else printf ("hai"); }

  • hello
  • hai
  • Compilation error
  • None of these
Show Answer Report

13. Find the output void main ( ) { switch (2) { case 2: printf("no"); continue; case 1: printf("output"); default : printf ("continue"); }

  • no
  • nononono....
  • nooutputcontinue
  • None of these
Show Answer Report

14. Which of the following is/are true for nested if I. It can only test for equality. II. Conditions may be repeatred for number of times. III. it can evaluate relational or logical expressions. IV. Character constants are automatically converted to integers.

  • I & II
  • I. II & III
  • II, III & IV
  • All o the above
Show Answer Report

15. Find the output. void main ( ) { int i=2; i++; if (i=4) printf("i=4"); else printf("i=3"); }

  • i=3
  • i=4
  • Garbage value
  • None of these
Show Answer Report

16. Find the output void main ( ) { int x, y; printf("%d", x=(y=5, y*y)); }

  • 5
  • 25
  • Invalid expressio
  • Compilation error
Show Answer Report

17. Find the output void main ( ) { char a='H'; switch (a) { case 'H': printf("%c", 'H'); case 'E": printf("%c", 'E'); case 'L': printf("%c", 'L')} case 'O': printf ("%c", 'O'); } }

  • HELLO
  • HEL
  • HELO
  • Compilation error
Show Answer Report

18. Which of the following is true about the switch statement ?

  • The default statement is necessary
  • The break statement is compulsory
  • The statements associated with a case do not form a block
  • Switch without case is worthless
Show Answer Report

19. Find the output void main ( ) { int x=1, y=2, z=3, result; result=(x+1?y>=2?z>3?1:2:3:4); printf("%d",result); }

  • 1
  • 2
  • 3
  • 4
Show Answer Report

20. Find the output void main ( ) { it (6>3) { printf("hello"); break; } else printf("bye"); }

  • hello
  • bye
  • Compilation error
  • None of these
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test