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

71. Find the output void main ( ) { int I; for (I=o; i<20; I++) { switch (I) { case 0; I +=5; cse 1 : I +=2; case 5 : I += 5; default : I +=4; } printf ("%d", I); } }

  • 0, 5, 9, 13,13
  • 5, 9, 13, 17,
  • 12, 17, 22,
  • 16, 21,
Show Answer Report

72. Find the ouptu void main ( ) { static int b; for (;b<5;b++) { printf("hello"); main ( ); } }

  • hello will display 5 times
  • hello will display unknown times
  • Infinite loop
  • Compilation error
Show Answer Report

73. Find the output void main ( ) { char str[20]; static int i; for (;;) { i++[str]='a'+15; if (i==19) break; } i [str]='\0'; printf ("%s", str); }

  • P
  • Garbage value
  • Compilation error
  • PPPPPPPPPPPPPPPPPPPP
Show Answer Report

74. Find the output. void main ( ) { unsigned int a=-1; static int count; while (a) { count++; a&a-1; } prrintf('5d", count); }

  • 0
  • 1
  • 16
  • None of these
Show Answer Report

75. Find the output void main ( ) { char a[10]={1, 2, 3, 4, 8, 6}; int x; for (x=0; x<4; x++) a[x]=x+'a'; printf("%s", a[x]); }

  • 123456
  • 56
  • 86
  • Garbage
Show Answer Report

76. Find the output. void main ( ) { int i=5, j=2; do { printf('%d", i--); } while (j==(float) printf("%d", 12)); }

  • 5
  • 54321
  • Compilation error
  • Infinite loop
Show Answer Report

77. Find the output. void main ( ) { int i=3; for (i--; i<7; exit (0)) printf("%d", i++); }

  • No output
  • 2
  • 23456
  • None of these
Show Answer Report

78. Find the output. void main ( ) { int i=9; for (i--; i--; i--) printf("%d"", i); }

  • 9 6 3
  • 7 5 3 1
  • Compiltion error.
  • Infinite Loop
Show Answer Report

79. Find the output. void main ( ) { int i; for (i=1; i<5; i++) { if (i<3) continue; else break; printf("5d', i); } printf('5d", i); }

  • 23
  • 33
  • 3
  • No output
Show Answer Report

80. Find the output void main ( ) { int a=0; for (a; ++a; a<=100) printf('5d',a); }

  • Print 1 to 100
  • Print 1 to 100 infinite times
  • Print 1 to -32768
  • Infinite loop
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test