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
21. When loop looses its stop value then it is called I. Odd loop II. Even loop III. Unknown loop IV. User friendly loop
- only I
- I & III
- III & IV
- II & IV
22. Which of the following loop is controlled by user ?
- for loop
- while loop
- do-while loop
- All of the above
23. Find the output void main ( ) { int i; for (i=1; i<=5; i++) { printf("%d", i); if (i==3) continue; i++; } }
- 123
- 12333.....
- 134
- 12345
24. Find the output. void main ( ) { char a[ ]={'\0', 'n', 'i', 'c', 'e'}; int i; for (i=0; i<sizeof(a); i++) printf ("%d", a[i]); }
- nice
- Prints nice with a space at the beginning
- Compilation error
- No output
25. Find the output void main ( ) [ char a[ ]={'\0', 'n', 'i', 'c', 'e'}; int ; for (i=0; i<sizeof (a); i++0 printf ("%c", a[i]); }
- nice
- Prints nice with a space at the beginning
- Compilation error
- No output
26. Find the output void main ( ) { int i=0; for ((; ++i<=5;) printf ('%d", i); }
- 0 1 2 3 4 5
- 1 2 3 4 5
- Compilation error
- Infinite loop
27. Find the output void main ( ) { int x=1; float y=3; do printf("%d', x++); while (x!=y); }
- 1 2
- 1 2 3
- Compilation error
- None of these
28. Find the output. void main ( ) { int x=5, y=6; do { x=x+y; y=x-y; x=x+y; } while (x<y); printf('%d %d", x, y); }
- 6 5
- 5 6
- Infinite loop
- None of these
29. Find the output void main ( ) { int x=15; while (x!0) { printf('%x", x); x=x/2; } }
- 15731
- 1111
- f731
- None of these
30. State the incorrect statement.
- In a while loop the control conditional heck is performed n time.
- In a do-while loop the control conditional check is performekd n+1 time.
- break is a keyword used with if and switch case.
- None of these