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

51. Find the output void main ( ) { int i; switch (i) { case 1; printf ('%d", i++); case 2: printf ('%d", i++); case 3: printf('5d", i++); default ; printf ('bye"); } } }

  • 123456789
  • 123123123
  • 123123123bye
  • 123bye
Show Answer Report

52. Find the output void main ( ) { int x=3; while (x--){ int x=10; x--; printc('5d", x); } }

  • 999999
  • 999
  • 2 1 0
  • 3 2 1
Show Answer Report

53. Find the bug in the followig program 1. void main ( ) { 2. while (1) { 3. if (printf('5d', printf("%d', 5))) 4. printf("%d", 3); 5. brak; 6. } 7. }

  • Line no. 3
  • Line no. 4
  • Line no. 5
  • None of these
Show Answer Report

54. Find the output void main ( ) { unsigned int i; for (i=5; i>-1; i--) printf("cite"); }

  • It will print 'cite' six times
  • It will print 'cite' infinite times
  • No output
  • Compilation error
Show Answer Report

55. Find the output #define MAX 10 void main ( ) { int i; for (i=0; i<MAX; i++) { static int count; count+=count; } printf('5d", count); }

  • 0
  • 45
  • 55
  • Compilation error
Show Answer Report

56. Find the output void main ( ) { int x=2 while (++ (x--)==2) printf("MCA"); printf("MBA"); }

  • MCAMCA.....
  • MCAMBA
  • MBA
  • Compilation error
Show Answer Report

57. Find the output void main ( ) { int i; for (i=1; i<=3; i++) { print: printf("C"); printf("%d", i); } }

  • Error; tag not allowed withing the loop
  • 1 2 3
  • C 1 C 2 C 3
  • Garbage value
Show Answer Report

58. Find the output void main ( ) { unsigned char c='0'; while (++c<=255) printf ("%d", c); }

  • Prints 48 to 255
  • Prints 1 to 255
  • Infinite loop
  • None of these
Show Answer Report

59. Find the output void main ( ) char c1; int i=0; c1='a'; while (c>=='a' && c1<='z') { c1++; i++; } printf ('%d", i); }

  • 25
  • 26
  • 123
  • None of these
Show Answer Report

60. Find the output enum (false, true); void main ( ) { int i=1; do { printf ("%d", i); i++; if (i<5) continue; } while (false); }

  • 123...15
  • 1
  • Compilation error
  • None of these
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test