Loop Questions and Answers

Practice Mode
Showing 10 of 98 questions
Q31
State the correct statement.
  • A a for loop may be nested in a while loop.
  • B A d-while loop may be nested in a for loop
  • C A while loop may be nested in a for loop
  • D All the above
Answer: Option D
Q32
Find the output void main ( ) { int i=32767u, x=49; while (i>3) { printf("%c', x); i++; } }
  • A 1
  • B 1111
  • C 1111.....
  • D Compilation error
Answer: Option A
Q33
Find the output void main ( ) { int x=5; for (;x<=5; if (x==5)) printf("%d', ++x); }
  • A 5
  • B 6
  • C Compilation error
  • D No output
Answer: Option C
Q34
Find the output. void main ( ) { int signed i=1; do { printf ("%d", i); } while (i--); }
  • A 1
  • B Infinte loop
  • C 10
  • D None of these
Answer: Option C
Q35
Find the output. void main ( ) { int i=1; while (i<=2) { printf("%d\i",i); } }
  • A %i%i
  • B 1 2
  • C % %
  • D Compilation error
Answer: Option B
Q36
Find the output void main ( ) { while (!" ") { printf ("Helo"); } }
  • A Prints Hello infinite times
  • B Hello
  • C No output
  • D Compilation error
Answer: Option C
Q37
Find the output. void main ( ) { int x=3; float y=1; while (x!=y) { x--; y++; if(x==y) printf ("%d %d", x, y); } }
  • A 2 3
  • B 2 suffering
  • C 2 2
  • D Compilation error
Answer: Option B
Q38
Find the output. void main ( ) { int i; for (i=0;i++<=5; printf ("5u", i); }
  • A 6
  • B 7
  • C Compilation error
Answer: Option B
Q39
Find the output static int i; void main ( ) { for (; ~i ; i--) printf ("%d', i); }
  • A 0 -1 -2 3
  • B 0
  • C 0 -1 0 -1
  • D none of these
Answer: Option B
Q40
Fint the output. void main ( ) unsigned int i=5; while (i-->=0) printf ("5d", i); }
  • A 12345
  • B Ivalue required
  • C Infinite loop
  • D None of these
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test