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

31. State the correct statement.

  • a for loop may be nested in a while loop.
  • A d-while loop may be nested in a for loop
  • A while loop may be nested in a for loop
  • All the above
Show Answer Report

32. Find the output void main ( ) { int i=32767u, x=49; while (i>3) { printf("%c', x); i++; } }

  • 1
  • 1111
  • 1111.....
  • Compilation error
Show Answer Report

33. Find the output void main ( ) { int x=5; for (;x<=5; if (x==5)) printf("%d', ++x); }

  • 5
  • 6
  • Compilation error
  • No output
Show Answer Report

34. Find the output. void main ( ) { int signed i=1; do { printf ("%d", i); } while (i--); }

  • 1
  • Infinte loop
  • 10
  • None of these
Show Answer Report

35. Find the output. void main ( ) { int i=1; while (i<=2) { printf("%d\i",i); } }

  • %i%i
  • 1 2
  • % %
  • Compilation error
Show Answer Report

36. Find the output void main ( ) { while (!" ") { printf ("Helo"); } }

  • Prints Hello infinite times
  • Hello
  • No output
  • Compilation error
Show Answer Report

37. Find the output. void main ( ) { int x=3; float y=1; while (x!=y) { x--; y++; if(x==y) printf ("%d %d", x, y); } }

  • 2 3
  • 2 suffering
  • 2 2
  • Compilation error
Show Answer Report

38. Find the output. void main ( ) { int i; for (i=0;i++<=5; printf ("5u", i); }

  • 6
  • 7
  • Compilation error
Show Answer Report

39. Find the output static int i; void main ( ) { for (; ~i ; i--) printf ("%d', i); }

  • 0 -1 -2 3
  • 0
  • 0 -1 0 -1
  • none of these
Show Answer Report

40. Fint the output. void main ( ) unsigned int i=5; while (i-->=0) printf ("5d", i); }

  • 12345
  • Ivalue required
  • Infinite loop
  • None of these
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test