C-Control Structure Question and Answer

C-Control Structure Question and Answer
21. Find the output
void main ( )
{
int a=5, b=3, c=2;
if (a>b>c)
printf("LINUX");
else
printf("WINDOWS");
}
  • WINDOWS
  • LINUX
  • Error: Multiple conditions not allowed in if statement
  • None of these
Show Answer
22. Find the output
void main ( )
{
int x=5, y=3;
if (x>y)
printf("HOT");
else;
printf("COLD");
}


  • HOT
  • COLD
  • HOTCOLD
  • Compilation error
Show Answer
23. Find the output.
void main ( )
{
int a=1;
if (a==2)return
printf("C Program");
}

  • No Output
  • C Program
  • Compile time Error
  • Run time Error
Show Answer
24. Which of the following statements causes unconditonal execution
  • Only break
  • Both break and continue
  • There is no unconditional execution in C
  • goto
Show Answer
25. Find the output
void main ( )
{
if (printf("bc"),
printf("a"), printf("bc"))
printf("hai");
else
printf("byte");
}

  • bchai
  • bcbye
  • bcabc
  • bcabchai
Show Answer
26. Which of the following switch statement is true?
I. int a=1, b=2, c=3, x;
switch (x)
{
switch (x>2)
{
case 1:
case a:
case 2:
case b:
case 3:
case c:
}
}
II. int x=5;
III. int x=2;
switch (x<B)
{
switch (x>1)
{
case 1:
swtich (5)
{
case 2: continue;
case 1:
case 3:
case 2:
}
}
}




  • Only I
  • Both I & II
  • Both I & II
  • None of these
Show Answer
27. Find the output
void main ( )
{
float x=3.y; double y=1.5;
if (x && y>1.5)
printf("fool");
else
printf("stupid");
}

  • fool
  • stupid
  • Garbage value
  • None of these
Show Answer
28. Find the output
int a=50, b=60, c=70;
if (! (a=15)>b)
b=100;
else
c=100;

  • 60 100
  • 100 70
  • 60 0
  • 60 70
Show Answer
29. Fint the output
void main ( )
{
int x=5;
if (x=1)
printf("one");
else
printf("five");
printf("%d",x);
}

  • one5
  • five5
  • one1
  • five1
Show Answer
30. Find the output.
void main ( )
{
int i=2;
switch (i>>1)
{
default: i++;
case 1:;
case 2:;
}
printf("%d",i);
}

  • 2
  • 1
  • Compilation error
  • None of these
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test