Control Structure Questions and Answers
Practice ModeShowing 10 of 97 questions
Q51
Find the output
void main ( )
{
int x=100, y=200, z=300, i=300;
if (i==z)
i=x;
else
y=y+z;
if (i!=z)
z=z+x;
else
y=y+z;
printf("5d", y);
}
Answer: Option B
Q52
Find the output
int i=4;
void main ( )
{
switch (i)
{
default:
;
case 3:
i +=5;
if (i==8);
{
i++;
if (i=9);
i*=2;
}
i -=4;
break;
case 8:
i +=5;
break;
}
printf("%d\n", i);
}
Answer: Option D
Q53
Find the output
void main ( )
{
int a=0, b=20;
char x=1, y=10;
if (x, b--, x--, x++)
printf("%d", x);
}
Answer: Option D
Q54
Find the output
void main ( )
{
int x=1, y=1, z;
if (y<0) if (y>0) x3;
else x=5;
printf("%d", x);
}
Answer: Option C
Q55
Find the output
int main ( )
{
unsigned val =0Xabcd;
if (vval>>16|val<<16)
{
printf("Success");
}
return;
printf("Failure");
}
Answer: Option A
Q56
Find the output
void main ( )
{
int a=1;
if (a)
printf ("Test");
else;
printf("Again");
}
Answer: Option D
Q57
Find the output
void main ( )
{
static int choice;
switch (-- choice, choice -1,
choice -1, choice+=2)
{
case 1:
printf("Choice1");
break;
case 2:
printf("Choice2");
break;
default ;
printf("Default");
}
}
Answer: Option A
Q58
Find the output
void main ( )
{
char ch='r';
if (ch=='a'||ch='h')
ch='u';
printf("%c", ch);
}
Answer: Option D
Q59
Find the output
#define FALSE -1
#define TRUE 1
#define NULL 0
void main ( )
{
if (NULL)
puts ("NULL");
else if(FALSE)
puts ("TRUE");
else { };;
puts ("FALSE");
}
Answer: Option B
Q60
Find the output
void some_method(int);
int i=1;
void main ( )
{
some_method (i);
}
some_method(i)
{
if (i)
{
printf {If");
some_method (0);
}
else
{
printf ("Else");
}
}
Answer: Option D