C-Loop Question and Answer

C-Loop Question and Answer
21. When loop looses its stop value then it is called
I. Odd loop
II. Even loop
III. Unknown loop
IV. User friendly loop

  • only I
  • I & III
  • III & IV
  • II & IV
Show Answer
22. Which of the following loop is controlled by user ?
  • for loop
  • while loop
  • do-while loop
  • All of the above
Show Answer
23. Find the output
void main ( )
{
int i;
for (i=1; i<=5; i++)
{
printf("%d", i);
if (i==3)
continue;
i++;
}
}

  • 123
  • 12333.....
  • 134
  • 12345
Show Answer
24. 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]);
}

  • nice
  • Prints nice with a space at the beginning
  • Compilation error
  • No output
Show Answer
25. 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]);
}

  • nice
  • Prints nice with a space at the beginning
  • Compilation error
  • No output
Show Answer
26. Find the output
void main ( )
{
int i=0;
for ((; ++i<=5;)
printf ('%d", i);
}

  • 0 1 2 3 4 5
  • 1 2 3 4 5
  • Compilation error
  • Infinite loop
Show Answer
27. Find the output
void main ( )
{
int x=1;
float y=3;
do
printf("%d', x++);
while (x!=y);
}

  • 1 2
  • 1 2 3
  • Compilation error
  • None of these
Show Answer
28. 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);
}

  • 6 5
  • 5 6
  • Infinite loop
  • None of these
Show Answer
29. Find the output
void main ( )
{
int x=15;
while (x!0)
{
printf('%x", x);
x=x/2;
}
}

  • 15731
  • 1111
  • f731
  • None of these
Show Answer
30. State the incorrect statement.

  • In a while loop the control conditional heck is performed n time.
  • In a do-while loop the control conditional check is performekd n+1 time.
  • break is a keyword used with if and switch case.
  • None of these
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test