C-Loop Question and Answer

C-Loop Question and Answer
81. Find the output
void main ( )
int i=2;
for (i=5; i=100; i++)
printf('%d", i);
}

  • 2
  • 5
  • 100
  • Print 100 infinite times
Show Answer
82. Find the output
void main ( )
{
int i;
for (i=1; i<=3; i++)
{
if (i==3)
break;
printf("%d", i);
}
for (i=1; i<=3; i++)
{
if (i==3)
goto last;
printf('5d', i)
}
last: ;
}

  • 123123
  • 1212
  • Compilation error
  • Garbage values
Show Answer
83. Find the output
void  main ( )
{
int i=5;
for (i=-5; !i; i++);
printf("%d", -i);
}


  • 5
  • 0
  • -5
  • None of these
Show Answer
84. Find the output
void main ( )
{
int i, j;
for (i=1, j=1, i<=10, j<=50; i++,, j++)
{
goto xy (1, 1);
printf("%d %d", i, j);
}
}

  • 10 10
  • 50 50
  • 10 50
  • None of these
Show Answer
85. Find the output
void main ( )
{
unsigned int x;
for (x=65535; x>=1; x++)
printf("no output");
}

  • no output
  • Prints no output infinite times
  • No output
  • None of these
Show Answer
86. Find the output
void main ( )
{
int i=10, j=2, k=0;
for (j=1; j<i; j=2*(i/j))
k+=j<7?2:3;
printf ("%d", k);
}
  • 2
  • 3
  • 6
  • None of these
Show Answer
87. Find the output
void main ( )
{
int i=0, sum=0;
int a[ ]={1, 2, 3, 0, 4, 5, 6, 7, 8, 9};
do
{
sum=suma[i];
i++;
}
while (a[i]);
printf("%d", sum);
}


  • 6
  • 15
  • 24
  • No output
Show Answer
88. Find the output
void main ( )
{
int i=1;
for (; (i==4) ? (i-4) : i++;
printf ("%d", i);
}

  • 1234
  • Infinite loop
  • No output
  • 234
Show Answer
89. Find the output
void main ( )
{
char s[ ]="Hello";
int i;
for (i=0; i<strlen(s)-1;i++)
{
s[i]=s[i] | 32;
putchar s[i]);
}
}

  • hELLO
  • HELLO
  • hell
  • Hell
Show Answer
90. Find the output
void main ( )
{
int a=0, i, j, k;
for (i=1; i<31;++i)
for (j=1; j<31;++j)
for (k=1; k<31; k++)
a+=1;
printf("%d", a);
}

  • 9000
  • 27000
  • 3000
  • None of these
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test