Loop Questions and Answers

Practice Mode
Showing 10 of 98 questions
Q81
Find the output void main ( ) int i=2; for (i=5; i=100; i++) printf('%d", i); }
  • A 2
  • B 5
  • C 100
  • D Print 100 infinite times
Answer: Option D
Q82
Find the output void main ( ) { int i; for (i=1; i<=3; i++) { if (i==3) break; printf("%d", i); } for (i=1; i<=3; i++) { if (i==3) goto last; printf('5d', i) } last: ; }
  • A 123123
  • B 1212
  • C Compilation error
  • D Garbage values
Answer: Option B
Q83
Find the output void  main ( ) { int i=5; for (i=-5; !i; i++); printf("%d", -i); }
  • A 5
  • B 0
  • C -5
  • D None of these
Answer: Option B
Q84
Find the output void main ( ) { int i, j; for (i=1, j=1, i<=10, j<=50; i++,, j++) { goto xy (1, 1); printf("%d %d", i, j); } }
  • A 10 10
  • B 50 50
  • C 10 50
  • D None of these
Answer: Option B
Q85
Find the output void main ( ) { unsigned int x; for (x=65535; x>=1; x++) printf("no output"); }
  • A no output
  • B Prints no output infinite times
  • C No output
  • D None of these
Answer: Option A
Q86
Find the output void main ( ) { int i=10, j=2, k=0; for (j=1; j<i; j=2*(i/j)) k+=j<7?2:3; printf ("%d", k); }
  • A 2
  • B 3
  • C 6
  • D None of these
Answer: Option A
Q87
Find the output void main ( ) { int i=0, sum=0; int a[ ]={1, 2, 3, 0, 4, 5, 6, 7, 8, 9}; do { sum=suma[i]; i++; } while (a[i]); printf("%d", sum); }
  • A 6
  • B 15
  • C 24
  • D No output
Answer: Option A
Q88
Find the output void main ( ) { int i=1; for (; (i==4) ? (i-4) : i++; printf ("%d", i); }
  • A 1234
  • B Infinite loop
  • C No output
  • D 234
Answer: Option D
Q89
Find the output void main ( ) { char s[ ]="Hello"; int i; for (i=0; i<strlen(s)-1;i++) { s[i]=s[i] | 32; putchar s[i]); } }
  • A hELLO
  • B HELLO
  • C hell
  • D Hell
Answer: Option C
Q90
Find the output void main ( ) { int a=0, i, j, k; for (i=1; i<31;++i) for (j=1; j<31;++j) for (k=1; k<31; k++) a+=1; printf("%d", a); }
  • A 9000
  • B 27000
  • C 3000
  • D None of these
Answer: Option B
Questions and Answers for Competitive Exams Various Entrance Test