C-Loop Question and Answer

C-Loop Question and Answer
91. Find the output.
void main ( )
{
char i=1;
for (i;i<127;i++)
printf("Foo1");
}

  • 0 1 2 3 4
  • 1 2 3 4 5
  • Error, 1value required
  • Infinite loop
Show Answer
92. Find the output.
void main ( )
{
int i=0;
while (!++<5)
{
printf("%d", i);
}
}

  • 0 1 2 3 4
  • 1 2 3 4 5
  • error, 1value required
  • Infinite loop
Show Answer
93. Find the output
void main ( )
{
int i=3;
while (i>0]
{
int i=5;
printf("%d", i)
i--;
}
}

  • 5 4 3 2 1
  • Compiltion error
  • 3 2 1
  • Infinite loop
Show Answer
94. Find the output.
void main ( )
int a[3]={7, 5, 9} , b=5, c;
while (b)
{
c=a [b] +b;
b--;
}
printf ("5d", c);
}


  • 6
  • 8
  • Compilation error
  • Garbage value
Show Answer
95. Find the output
void main ( )
{
int a=4, b=5, s=0;
while (a+b<15)
{
s+=a+b;
}
printf('5d", s);
}

  • 33
  • 22
  • 27
  • Infinite loop
Show Answer
96. Find the output
void main ( )
{
int i, j=6;
for (; i=j; j-=2)
printf("5d', j));
}

  • 642
  • 6420
  • Compilation error
  • Garbage values
Show Answer
97. Find the output
void main ( )
{
int i;
for (i=-5; ~i; i++)
printf("%d", i);
}

  • -5 -4 -3 -2 -1
  • -5 -4 -3 -2
  • No output
  • Infinite loop
Show Answer
98. Find the output.
void main ( )
{
int x=0;
int y=4;
c1str ( );
switch(x)
{
case 0:
while (y>0)
do
{
case 1; x++;
case 2: ++x;
}
while (--y>0);
}
printf("5d", x);
}

  • 0
  • 4
  • 8
  • Compilation error
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test