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
1. Which of the following is true about "for" loop?
- Any of the three experssions may be omitted
- The openng and closing parentheses and the semicoons must be included.
- The initial expression is evaluated only once.
- All the above
2. Find the output void main ( ) { int x=10, y; for (y=10; y!=x;++y) printf ("%d", y); printf("%d", y); }
- 10 11
- 10
- 11
- None of these
3. If a loop loses its start value that loop is called as
- Odd loop
- Unknown loop
- At least once
- Infinite loop
4. Find the output void main ( ) { int i=1; do { printf("%d", i); i++; } while (!i==5); }
- 1 2 3 4 5
- 1 2 3 4 5 6
- 1
- None of these
5. Find the output void main ( ) { int i; for (i=0; i<3; i++); printf("%d", i*i); printf ("strange"); }
- 9strange
- 014strange
- strange
- Compilation error
6. Find the output void main ( ) { int i; for (i=0; i<3; i++); printf("%d", i*i); printf ("strange"); }
- 9strange
- 014strange
- strange
- Compilation error
7. Find the output void main ( ) { int i, j=1; for (i=1; i<5; i++) while (j<5) { printf ("%d', i+j); if(i==2&& j==2) break; j++; } }
- 23454556
- 2345
- Compilation error
- None of these
8. Find the output void main ( ) { int i=1; while (!i=5) { printf ("%d", i); i++; } }
- 1
- 12345
- 1234
- Compilation error
9. Find the output void main ( ) { for (putchar ('g'), i); putchar ('o'putchar ('d')) putchar ('s'); }
- godsgodsgods...
- gosdgosdgosd...
- gosdosdosdosd...
- Compilation error
10. Find the output void main ( ) { char m[ ]={"hello world"}' int n; for (c=sizeof(m); m; putch(m)[-n])); }
- d1row olleh
- hello world
- dddddddddd.....
- infinite loop