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

51. Find the output void main ( ) { int x=100, y=200, z=300, i=300; if (i==z) i=x; else y=y+z; if (i!=z) z=z+x; else y=y+z; printf("5d", y); }

  • 100
  • 200
  • 300
  • 500
Show Answer Report

52. Find the output int i=4; void main ( ) { switch (i) { default: ; case 3: i +=5; if (i==8); { i++; if (i=9); i*=2; } i -=4; break; case 8: i +=5; break; } printf("%d\n", i); }

  • 5
  • 16
  • 18
  • 14
Show Answer Report

53. Find the output void main ( ) { int a=0, b=20; char x=1, y=10; if (x, b--, x--, x++) printf("%d", x); }

  • 0
  • 1
  • 2
  • None of the above
Show Answer Report

54. Find the output void main ( ) { int x=1, y=1, z; if (y<0) if (y>0) x3; else x=5; printf("%d", x); }

  • 5
  • 3
  • 1
  • Compilation error
Show Answer Report

55. Find the output int main ( ) { unsigned val =0Xabcd; if (vval>>16|val<<16) { printf("Success"); } return; printf("Failure"); }

  • No output
  • Success
  • Failure
  • SuccessFailure
Show Answer Report

56. Find the output void main ( ) { int a=1; if (a) printf ("Test"); else; printf("Again"); }

  • Again
  • Test
  • Compilation error
  • TestAgain
Show Answer Report

57. Find the output void main ( ) { static int choice; switch (-- choice, choice -1, choice -1, choice+=2) { case 1: printf("Choice1"); break; case 2: printf("Choice2"); break; default ; printf("Default"); } }

  • Choice1
  • Choice2
  • Default
  • None of these
Show Answer Report

58. Find the output void main ( ) { char ch='r'; if (ch=='a'||ch='h') ch='u'; printf("%c", ch); }

  • r
  • a
  • u
  • Compilation error
Show Answer Report

59. Find the output #define FALSE -1 #define TRUE   1 #define NULL 0 void main ( ) { if (NULL) puts ("NULL"); else if(FALSE) puts ("TRUE"); else { };; puts ("FALSE"); }

  • TRUE TRUE
  • TRUE FALSE
  • FALSE FALSE
  • FALSE TRUE
Show Answer Report

60. Find the output void some_method(int); int i=1; void main ( ) { some_method (i); } some_method(i) { if (i) { printf {If"); some_method (0); } else { printf ("Else"); } }

  • IfElse
  • E1self
  • If
  • Compilation error
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test