C-Control Structure Question and Answer

C-Control Structure Question and Answer
71. Find the output
void main ( )
{
int x=2;
switch (x)
{
case 1:case 2:cse 3:
printf("fool");
default:
break;
}
}

  • Fool
  • No output
  • Expression syntax
  • None of these
Show Answer
72. 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);
}
}


  • 0, 1, 3, 6, 7, 8
  • 0, 1, 3
  • 6, 10
  • 5, 10
Show Answer
73. Find the output.
void main ( )
{
switch (0)
{
case '0':
printf("Fool");
break;
case '\0:'
printf("Mad");
}
}


  • Fool
  • Mad
  • Compilation error
  • None of these
Show Answer
74. Find the output
void main ( )
{
float f=0.9;
double d=0.9f;
if (f==d)
printf("ar");
else
printf("Near");
}

  • Dear
  • Near
  • Compilation error
  • None of these
Show Answer
75. Find the output
void main ( )
{
int x=4;
char y=4;
if (x==y)
printf ("Equal");
else
printf("Not equal");
}

  • Equal
  • Not equal
  • Compilation error
  • No output
Show Answer
76. Find the output
void main ( )
{
int ch='a;
switch (ch)
{
case 'a':
printf("%d", 'a');
case 97:
printf("Foo1");
default:
printf('Good");
}


  • 97Fool
  • Good
  • Fool
  • Compilation error
Show Answer
77. To execute al switch case statements
  • Any one of the case statement match with switch condition
  • First case must match with switch condition
  • Default case must match with switch condition.
  • None of these
Show Answer
78. 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);
}

  • 30 30
  • 3 3
  • Compilation error
  • None of these
Show Answer
79. 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;
}

  • 20
  • 15
  • 5
  • 10
Show Answer
80. 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");
}

  • Good
  • Boy
  • Good boy
  • Compilation error
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test