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

91. Find the output void main ( ) { int x=5; begin: if (x) { printf ("%d", x); x--; goto begin; } }

  • No output
  • 5
  • 54321
  • Garbage value
Show Answer Report

92. Find the output #define a i++ void main ( ) { int i=0; if (0==a); #define a --1 else #define a ++i printf ("%d", a); }

  • 2
  • Garbage
  • No output
  • Compilation error
Show Answer Report

93. Find the output void main ( ) { int a=0; switch (a) { case 0: switch (a) { case 0: goto default; break; case 1: printf ("ho ho"); default : printf ("ha ha"); } case 1: printf ("he he"); default : printf (" "); } }

  • ha ha he he
  • ha ha
  • No output
  • Compilation error
Show Answer Report

94. Find the output void main ( ) { int i; for (i=1; i<=450; i++) printf("Hello"); if (i==10) break; printf("Hi"); }

  • Hello 10 times
  • Hello 10 times and hi
  • Hello 450 times and hi once
  • Compilation error
Show Answer Report

95. Find the output void main ( ) { int i=98; while (100-i++) printf ("%u", i); switch (i) case 'e': printf ("Foo1"); }

  • 98 99 100
  • 99 100
  • 99 100 Foo1
  • Compilation error
Show Answer Report

96. Find the output #define switch case #define if switch void main ( ) { int i=1; if (i) { switch 1: { case 0: printf ("It's magic"); break; } case 2: printf ("\n No magic"); break; case 1*2+4: printf("it's music"); } }

  • It's magic
  • No magic
  • No output
  • Compilation error
Show Answer Report

97. Find the output void main ( ) { int i=10, j=15, k=5; if ((i?j:k)=J%3) printf ("%d",j); }

  • 5
  • 15
  • 3
  • Compilation error
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test