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
11. Find the output void main ( ) { for putchar ('g'); putchar ('o'); putchar ('d')) putchar ('s'); }
- godsgodsgods...
- gosdgosdgosd...
- gosdosdosdosd...
- Compilation error
12. Find the output void main ( ) { it num = 345, m,sum=0; do { m=num%10; num=num/10; continue; sum=sum*10+m; } while (num!=0); printf ('%d", sum); }
- 345
- 543
- 0
- None of these
13. Find the output void main ( ) { int i,j; for (i=0, j=0; i<3, j<2: i++; j++) printf ("ok"); }
- ok
- okok
- Compilation error
- None of these
14. In which of the following loop/loops, he precise number of times the loop will be executed is known in advance.
- for loop
- while loop
- do-while loop
- Both b and c
15. Which of the following is an exit controlled loop?
- while
- do while
- for
- continue
16. Which of the following is an inifinite loop ? I. while (1) { } II. while (-1){ } III. while (!0)) { } IV. while ('a') { }
- only I
- I & III
- I & III
- All of the above
17. Which of the following is/are appropriate to give time delay usingg loop? I. for (i=1; i<100; i++) {;} II. i=1; while (i++<=100) { } III. i=1; do { } while (i++<=100);
- Only I
- II & III
- I & III
- All of the above
18. 'repeat-until' construct of PASCAL language is same as
- while construct
- for construct
- do-while construct
- Both while and do-while construct
19. Find the output void main ( ) { int i, t=1, s=1; for (i=2; i<=5; i++) { t+=i; s+=t; } pritf ("%d %d", t,s,); }
- 10 45
- 15 35
- 10 20
- None of these
20. Find the output void main ( ) { int i=65, j=0; for (j;j<4; j++) { i+1; printf("%d", i++); } }
- B C D E
- A B C D
- 66 67 68 69
- None of these