C-Loop Question and Answer

C-Loop Question and Answer
31. State the correct statement.

  • a for loop may be nested in a while loop.
  • A d-while loop may be nested in a for loop
  • A while loop may be nested in a for loop
  • All the above
Show Answer
32. Find the output
void main ( )
{
int i=32767u, x=49;
while (i>3)
{
printf("%c', x);
i++;
}
}

  • 1
  • 1111
  • 1111.....
  • Compilation error
Show Answer
33. Find the output
void main ( )
{
int x=5;
for (;x<=5; if (x==5))
printf("%d', ++x);
}

  • 5
  • 6
  • Compilation error
  • No output
Show Answer
34. Find the output.
void main ( )
{
int signed i=1;
do
{
printf ("%d", i);
}
while (i--);
}

  • 1
  • Infinte loop
  • 10
  • None of these
Show Answer
35. Find the output.
void main ( )
{
int i=1;
while (i<=2)
{
printf("%d\i",i);
}
}

  • %i%i
  • 1 2
  • % %
  • Compilation error
Show Answer
36. Find the output
void main ( )
{
while (!" ")
{
printf ("Helo");
}
}

  • Prints Hello infinite times
  • Hello
  • No output
  • Compilation error
Show Answer
37. Find the output.
void main ( )
{
int x=3;
float y=1;
while (x!=y)
{
x--;
y++;
if(x==y)
printf ("%d %d", x, y);
}
}



  • 2 3
  • 2 suffering
  • 2 2
  • Compilation error
Show Answer
38. Find the output.
void main ( )
{
int i;
for (i=0;i++<=5;
printf ("5u", i);
}

  • 6
  • 7
  • Compilation error
Show Answer
39. Find the output
static int i;
void main ( )
{
for (; ~i ; i--)
printf ("%d', i);
}

  • 0 -1 -2 3
  • 0
  • 0 -1 0 -1
  • none of these
Show Answer
40. Fint the output.
void main ( )
unsigned int i=5;
while (i-->=0)
printf ("5d", i);
}

  • 12345
  • Ivalue required
  • Infinite loop
  • None of these
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test