Loop Questions and Answers
Practice ModeShowing 10 of 98 questions
Q71
Find the output
void main ( )
{
int I;
for (I=o; i<20; I++)
{
switch (I)
{
case 0; I +=5;
cse 1 : I +=2;
case 5 : I += 5;
default : I +=4;
}
printf ("%d", I);
}
}
Answer: Option D
Q72
Find the ouptu
void main ( )
{
static int b;
for (;b<5;b++)
{
printf("hello");
main ( );
}
}
Answer: Option B
Q73
Find the output
void main ( )
{
char str[20];
static int i;
for (;;)
{
i++[str]='a'+15;
if (i==19)
break;
}
i [str]='\0';
printf ("%s", str);
}
Answer: Option A
Q74
Find the output.
void main ( )
{
unsigned int a=-1;
static int count;
while (a)
{
count++;
a&a-1;
}
prrintf('5d", count);
}
Answer: Option C
Q75
Find the output
void main ( )
{
char a[10]={1, 2, 3, 4, 8, 6};
int x;
for (x=0; x<4; x++)
a[x]=x+'a';
printf("%s", a[x]);
}
Answer: Option D
Q76
Find the output.
void main ( )
{
int i=5, j=2;
do
{
printf('%d", i--);
}
while (j==(float) printf("%d", 12));
}
Answer: Option D
Q77
Find the output.
void main ( )
{
int i=3;
for (i--; i<7; exit (0))
printf("%d", i++);
}
Answer: Option B
Q78
Find the output.
void main ( )
{
int i=9;
for (i--; i--; i--)
printf("%d"", i);
}
Answer: Option A
Q79
Find the output.
void main ( )
{
int i;
for (i=1; i<5; i++)
{
if (i<3)
continue;
else
break;
printf("5d', i);
}
printf('5d", i);
}
Answer: Option C
Q80
Find the output
void main ( )
{
int a=0;
for (a; ++a; a<=100)
printf('5d',a);
}
Answer: Option C