Control Structure Questions and Answers
Practice ModeShowing 10 of 97 questions
Q31
Find the output
void main ( )
{
enum e{red, green};
enum e ee=red;
switch (ee)
{
case red:
printf("red");
break;
case green:
printf("green");
break;
}
}
Answer: Option A
Q32
Find the output
void main ( )
{
int ch=2;
switch (ch++)
{
case 1:
printf("%d", ++ch);
case 2:
printf("%d", ++ch);
default:
printf("%d", ++ch);
}
}
Answer: Option C
Q33
Find the output
void main ( )
int a=2, b=3;
do
{
a=a^b;
a=b^a;
a=a^b;
continue;
}
while (a==3);
printf("%d%d", a, b);
}
Answer: Option A
Q34
Find the output
void main ( )
{
int a=5;
while (a!=1)
{
goto xx;
xx: printf("%d", a--);
}
}
Answer: Option C
Q35
Find the output.
void main ( )
{
int i=5;
if (i==5)
return;
else
printf("%d",i);
printf("bye");
}
Answer: Option C
Q36
Find the output
void main {
float f=3.2;
switch (f!=3.2)
{
default:
printf("no result");
case 0:
printf ("false");
case 1;
printf("true");
break;
}
}
Answer: Option A
Q37
'continue'statement is used in
Answer: Option B
Q38
Find the output
void main ( )
{
float f=2.5;
if (f==2.5)
printf ("right");
else
prrintf ("wrong");
}
Answer: Option A
Q39
Find the output
void main ( )
{
int i=1, j=2, k=3;
if (i==1)
if (j==2)
if (k==3)
{
printf("ok");
break
}
else
printf("continue");
printf("bye");
}
Answer: Option C
Q40
Find the output
void main ( )
{
int i=5;
switch (i)
{
static int i;
i=3;
i=i*i;
case 3:
i=i+i;
case 5:
i=i+i;
default :
i=i+i;
printf("%d", i);
}
printf ('%d", i);
}
Answer: Option C