Control Structure Questions and Answers
Practice ModeShowing 10 of 97 questions
Q81
Find the output
void magic (int);
void main ( )
{
int a=100;
magic (a);
}
void magic (int a)
{
if (a!=0)
{
printf ("%c", "abcdefgh" [a%8]);
}
else
printf ("\n");
}
Answer: Option D
Q82
Find the output
void main ( )
{
int i=1;
for (i, i++<=3;)
{
switch (i)
{
case 1:
printf("one");
continue;
case 2:
printf ("two");
break;
case 3:
printf ("three");
continue;
}
}
}
Answer: Option B
Q83
Find the output
int main (int k)
{
if (k<5)
printf("%d ", main (k+1));
return k;
}
Answer: Option B
Q84
Find the output
void main ( )
{
int i=1, j=-1;
if ((printf("%d", i))<
(printf("%d", j)))
printf ("%d", i);
else
printf ("%d", j);
}
Answer: Option A
Q85
Find the output
void main ( )
{
int i=12;
if (i==12)
{
i=10;
}
else
{
i=20;
}
printf("%d", i);
}
Answer: Option B
Q86
Which of the following is incorrect about a switch statement ?
Answer: Option C
Q87
Find the output
void main ( )
{
int _if=1, else=5;
if (_if==10);
else (_else==7);
printf ("%d",_else);
}
Answer: Option A
Q88
Find the output
void main ( )
{
while (1)
{
if (printf("%d", printf ("5d")))
{
printf("Hi");
break;
}
else
printf("HoHo");
}
}
Answer: Option B
Q89
Find the output
void main ( )
{
int x=0, y=0;
if (!x)
{
y=!x;
if (y)
x=!y;
}
printf ("%d %d", x,y);
}
Answer: Option C
Q90
Find the output
void main ( )
{
int i=1;
switch (i)
{
case 1;
switch (i)
printf ("\nFM");
case 1*2+4:
printf("Radio");
}
}
Answer: Option C