Loop Questions and Answers

Practice Mode
Showing 10 of 98 questions
Q21
When loop looses its stop value then it is called I. Odd loop II. Even loop III. Unknown loop IV. User friendly loop
  • A only I
  • B I & III
  • C III & IV
  • D II & IV
Answer: Option C
Q22
Which of the following loop is controlled by user ?
  • A for loop
  • B while loop
  • C do-while loop
  • D All of the above
Answer: Option B
Q23
Find the output void main ( ) { int i; for (i=1; i<=5; i++) { printf("%d", i); if (i==3) continue; i++; } }
  • A 123
  • B 12333.....
  • C 134
  • D 12345
Answer: Option C
Q24
Find the output. void main ( ) { char a[ ]={'\0', 'n', 'i', 'c', 'e'}; int i; for (i=0; i<sizeof(a); i++) printf ("%d", a[i]); }
  • A nice
  • B Prints nice with a space at the beginning
  • C Compilation error
  • D No output
Answer: Option A
Q25
Find the output void main ( ) [ char a[ ]={'\0', 'n', 'i', 'c', 'e'}; int ; for (i=0; i<sizeof (a); i++0 printf ("%c", a[i]); }
  • A nice
  • B Prints nice with a space at the beginning
  • C Compilation error
  • D No output
Answer: Option A
Q26
Find the output void main ( ) { int i=0; for ((; ++i<=5;) printf ('%d", i); }
  • A 0 1 2 3 4 5
  • B 1 2 3 4 5
  • C Compilation error
  • D Infinite loop
Answer: Option B
Q27
Find the output void main ( ) { int x=1; float y=3; do printf("%d', x++); while (x!=y); }
  • A 1 2
  • B 1 2 3
  • C Compilation error
  • D None of these
Answer: Option A
Q28
Find the output. void main ( ) { int x=5, y=6; do { x=x+y; y=x-y; x=x+y; } while (x<y); printf('%d %d", x, y); }
  • A 6 5
  • B 5 6
  • C Infinite loop
  • D None of these
Answer: Option A
Q29
Find the output void main ( ) { int x=15; while (x!0) { printf('%x", x); x=x/2; } }
  • A 15731
  • B 1111
  • C f731
  • D None of these
Answer: Option C
Q30
State the incorrect statement.
  • A In a while loop the control conditional heck is performed n time.
  • B In a do-while loop the control conditional check is performekd n+1 time.
  • C break is a keyword used with if and switch case.
  • D None of these
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test