C-Control Structure Question and Answer

C-Control Structure Question and Answer
61. Find the output
void main ( )
{
int a,b,c=4;
if (a=c%2)
b=5;
printf("%d", b);
}

  • 5
  • 0
  • No output
  • Garbage value
Show Answer
62. Find the output
void main ( )
{
char a='A';
if ((a=='z') | | ((a='L') &&
(sizeof (a='\0'))))
a=a;
printf("%c", a);
printf("Nothing");
}

  • A Nothing
  • Nothing
  • L Nothing
  • Z Nothing
Show Answer
63. switch statement only tests for
  • Relational expression
  • Logical expression
  • Equality
  • All the above
Show Answer
64. Find the output.
voidmain ( )
{
int x=1;
if (x++>=x)
printf("%d",x);
else
printf("%d", ++x)
}

  • 2
  • 3
  • Compilation error
  • None of these
Show Answer
65. Find the output
void main ( )
{
int i, j;
for (i=1, j=5; i++, j--;)
{
if (i==j)
continue;
printf("%d", i);
}
}

  • 2 4 5 6
  • 1 2 4 5
  • Compilation error
  • None of these
Show Answer
66. Which is true about break statement?
  • break can make early exit from the block where it appears.
  • break can't be used in 'if' construct
  • Both a and b
  • None of these
Show Answer
67. Find the output
void main ( )
{
char c='\b';
if (c==8)
printf("true");
else
printf("false");
}

  • true
  • false
  • Compilation error
  • No output
Show Answer
68. Find the output
void main ( )
{
char ch;
if("printf(")")
printf("ok");
else
printf("Bye");
}

  • Ok
  • Bye
  • 0Ok
  • 0Bye
Show Answer
69. Find the output
void main ( )
int x=1, y=3, z=0;
if (x!=y>=z)
printf("Right");
else
printf("Wrong");
}

  • Right
  • Wrong
  • compilation error
  • None of these
Show Answer
70. Find the output
void main ( )
{
int a=4, b=8, c=3;
if (a+b!c)
printf("True");
else
printf("False");
}

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