Loop Questions and Answers
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
32. Find the output void main ( ) { int i=32767u, x=49; while (i>3) { printf("%c', x); i++; } }
- 1
- 1111
- 1111.....
- Compilation error
33. Find the output void main ( ) { int x=5; for (;x<=5; if (x==5)) printf("%d', ++x); }
- 5
- 6
- Compilation error
- No output
34. Find the output. void main ( ) { int signed i=1; do { printf ("%d", i); } while (i--); }
- 1
- Infinte loop
- 10
- None of these
35. Find the output. void main ( ) { int i=1; while (i<=2) { printf("%d\i",i); } }
- %i%i
- 1 2
- % %
- Compilation error
36. Find the output void main ( ) { while (!" ") { printf ("Helo"); } }
- Prints Hello infinite times
- Hello
- No output
- Compilation error
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
38. Find the output. void main ( ) { int i; for (i=0;i++<=5; printf ("5u", i); }
- 6
- 7
- Compilation error
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
40. Fint the output. void main ( ) unsigned int i=5; while (i-->=0) printf ("5d", i); }
- 12345
- Ivalue required
- Infinite loop
- None of these