Control Structure Questions and Answers
Practice ModeShowing 10 of 97 questions
Q71
Find the output
void main ( )
{
int x=2;
switch (x)
{
case 1:case 2:cse 3:
printf("fool");
default:
break;
}
}
Answer: Option A
Q72
Find the output
void main ( )
{
int i;
for (i=0; i<10;i++
{
switch (i)
{
case 0: i+=0;
case 1: i+=1;
case 2: i+=2;
default: i+=3;
break;
}
printf("%d", i);
}
}
Answer: Option C
Q73
Find the output.
void main ( )
{
switch (0)
{
case '0':
printf("Fool");
break;
case '\0:'
printf("Mad");
}
}
Answer: Option B
Q74
Find the output
void main ( )
{
float f=0.9;
double d=0.9f;
if (f==d)
printf("ar");
else
printf("Near");
}
Answer: Option A
Q75
Find the output
void main ( )
{
int x=4;
char y=4;
if (x==y)
printf ("Equal");
else
printf("Not equal");
}
Answer: Option A
Q76
Find the output
void main ( )
{
int ch='a;
switch (ch)
{
case 'a':
printf("%d", 'a');
case 97:
printf("Foo1");
default:
printf('Good");
}
Answer: Option D
Q77
To execute al switch case statements
Answer: Option B
Q78
Find the output
void main ( )
{
int c=12, d=15;
while (c!=d)
{
if (c>d)
c=c-d;
else
d=d=c;
}
printf("%d %d", c, d);
}
Answer: Option B
Q79
Find the output
void main ( )
{
int a=20, b=15, c;
c=func (a,b);
printf ("%d", c);
}
int func (int a, int b)
{
if (a!=b)
if (a<b)
func (b,a);
else
func (b,a-b);
else
return a;
}
Answer: Option C
Q80
Find the output
void main ( )
{
int a, b, c, d;
a=b=c=5;
if (d=(a==b))
if (d==c)
printf("good");
else
printf("Boy");
else
printf ("Good boy");
}
Answer: Option B