Loop Questions and Answers
Practice ModeShowing 10 of 98 questions
Q81
Find the output
void main ( )
int i=2;
for (i=5; i=100; i++)
printf('%d", i);
}
Answer: Option D
Q82
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: ;
}
Answer: Option B
Q83
Find the output
void main ( )
{
int i=5;
for (i=-5; !i; i++);
printf("%d", -i);
}
Answer: Option B
Q84
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);
}
}
Answer: Option B
Q85
Find the output
void main ( )
{
unsigned int x;
for (x=65535; x>=1; x++)
printf("no output");
}
Answer: Option A
Q86
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);
}
Answer: Option A
Q87
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);
}
Answer: Option A
Q88
Find the output
void main ( )
{
int i=1;
for (; (i==4) ? (i-4) : i++;
printf ("%d", i);
}
Answer: Option D
Q89
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]);
}
}
Answer: Option C
Q90
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);
}
Answer: Option B