Loop Questions and Answers

Practice Mode
Showing 10 of 98 questions
Q41
Find the output void main ( ) { int i; while (i=strrcmp ("cite", "cite\0")); }
  • A 0
  • B 1
  • C 11111....
  • D None of these
Answer: Option A
Q42
Find the output void main ( ) { int i; for (i=3; i<15; i+=3); printf("%d", i); }
  • A 3 6 9 12
  • B 3 3 3 3
  • C 15
  • D 12
Answer: Option C
Q43
In a for loop if the condition is missing then.
  • A it is assumed to be present and taken to be true.
  • B it is assumed to be present and taken to be false
  • C It results in a syntax error
  • D Execution will be terminated abrupty.
Answer: Option A
Q44
Find the output. void main ( ) { int i, j; for (i=3; i>=1;j--) for (j=i;j>=1' j--) printf ("%d", i); }
  • A 321211
  • B 333221
  • C 332211
  • D 123233
Answer: Option B
Q45
Find the output void main ( ) { int i=5. c=0; do { i--; c++; } whie (i==0); printf('%d', c); }
  • A 3
  • B 4
  • C 1
  • D None of these
Answer: Option C
Q46
Find the correct output. void main ( ) { while (99) { if (printf("%d", printf ('%d"))) break; else continue; } }
  • A 0 1
  • B 0 0
  • C Infinite loop
  • D None of these
Answer: Option A
Q47
How many times the loop will be executed ? void main ( ) { int i=0; for (;i++;) printf ("%d", i); }
  • A Infinite times
  • B 32767
  • C 0
  • D The maximum integer value for a particular machine
Answer: Option C
Q48
How many times a for loop will exeuted in this program ? void main ( ) { char ch; for (ch=0; ch<128; ch+4) printf('%d", ch); }
  • A 127 times
  • B 64 times
  • C 32 times
  • D Infinite times
Answer: Option D
Q49
Find the output void main ( ) int x=0; for (;;) { if (++x==6) break; continue; } printf('X=%d", x); }
  • A X=5
  • B X=6
  • C X=7
  • D Unpredictable output
Answer: Option B
Q50
Infinite loop can be used for
  • A Time delay
  • B Terminate execution
  • C Software delay
  • D Useless
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test