Loop Questions and Answers

Take Exam

Loop Questions with Answers are among the most frequently asked topics in C programming aptitude and placement exams. These programming questions and answers test your understanding of iteration techniques such as for, while, and do-while loops. Practicing C loop MCQs with explanations helps you strengthen your logic-building skills and code efficiency. Commonly featured in Infosys, Accenture, and TCS placement papers, these loop-based problems prepare you for both theoretical and coding assessments. Access free C programming loop questions with answers PDF or take mock tests online for real exam experience.

Loop

Showing 10 of 98 questions

91. Find the output. void main ( ) { char i=1; for (i;i<127;i++) printf("Foo1"); }

  • 0 1 2 3 4
  • 1 2 3 4 5
  • Error, 1value required
  • Infinite loop
Show Answer Report

92. Find the output. void main ( ) { int i=0; while (!++<5) { printf("%d", i); } }

  • 0 1 2 3 4
  • 1 2 3 4 5
  • error, 1value required
  • Infinite loop
Show Answer Report

93. Find the output void main ( ) { int i=3; while (i>0] { int i=5; printf("%d", i) i--; } }

  • 5 4 3 2 1
  • Compiltion error
  • 3 2 1
  • Infinite loop
Show Answer Report

94. Find the output. void main ( ) int a[3]={7, 5, 9} , b=5, c; while (b) { c=a [b] +b; b--; } printf ("5d", c); }

  • 6
  • 8
  • Compilation error
  • Garbage value
Show Answer Report

95. Find the output void main ( ) { int a=4, b=5, s=0; while (a+b<15) { s+=a+b; } printf('5d", s); }

  • 33
  • 22
  • 27
  • Infinite loop
Show Answer Report

96. Find the output void main ( ) { int i, j=6; for (; i=j; j-=2) printf("5d', j)); }

  • 642
  • 6420
  • Compilation error
  • Garbage values
Show Answer Report

97. Find the output void main ( ) { int i; for (i=-5; ~i; i++) printf("%d", i); }

  • -5 -4 -3 -2 -1
  • -5 -4 -3 -2
  • No output
  • Infinite loop
Show Answer Report

98. Find the output. void main ( ) { int x=0; int y=4; c1str ( ); switch(x) { case 0: while (y>0) do { case 1; x++; case 2: ++x; } while (--y>0); } printf("5d", x); }

  • 0
  • 4
  • 8
  • Compilation error
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test