Choose a C Conditional Operator from the list.
- ?:
- :?
- :<
- <:
What is the other name for C Language ?: Question Mark Colon Operator.?
- Comparison Operator
- If-Else Operator
- Binary Operator
- Ternary Operator
Choose a syntax for C Ternary Operator from the list.
- condition ? expression1 : expression2
- condition : expression1 ? expression2
- condition ? expression1 < expression2
- condition < expression1 ? expression2
What is the output of the C statement.?
int main()
{
int a=0;
a = 5<2 ? 4 : 3;
printf("%d",a);
return 0;
}
- 4
- 3
- 5
- 2
What is the output of C Program.?
int main()
{
int a=0;
a = printf("4");
printf("%d",a);
return 0;
}
- 04
- compiler error
- 40
- 41
What is the output of the C Program.?
int main()
{
int a=0;
a = 5>2 ? printf("4"): 3;
printf("%d",a);
return 0;
}
- compiler error
- 14
- 41
- 0
What is the output of the C Program.?
int main()
{
int a=0;
a = (5>2) ? : 8;
printf("%d",a);
return 0;
}
- 0
- 1
- 8
- compiler error
What is the output of C Program.?
int main()
{
int a=0, b;
a = (5>2) ? b=6: b=8;
printf("%d %d",a, b);
return 0;
}
- 6 6
- 0 6
- 0 8
- compiler error
Choose a correct statement regarding C Comparison Operators.
- (x == y) Is x really equal to y.
(x != y) Is x not equal to y. - (x < y) Is x less than y
(x > y) Is x greater than y - (x <= y) Is x less than or equal to y.
(x >= y) Is x greater than or equal to y - All the above
Choose a statement to use C If Else statement.
- else if is compulsory to use with if statement.
- else is compulsory to use with if statement.
- else or else if is optional with if statement
- None of the above
Choose a correct C Statement using IF Conditional Statement.
- if( condition )
{
//statements;
} - if( condition )
{
//statements;
}
else
{
//statements;
} - if( condition1 )
{
//statements;
}
else if( condition2)
{
//statements;
}
else
{
//statements;
} - All the above.
What is the output of the C Program.?
int main()
{
if( 4 > 5 )
{
printf("Hurray..\n");
}
printf("Yes");
return 0;
}
- Yes
- Hurray..
Yes - Hurray..Yes
- Compiler error
What is the output of the C Program.?
int main()
{
if( 4 > 5 )
printf("Hurray..\n");
printf("Yes");
return 0;
}
- Yes
- Hurray..
Yes - Hurray..Yes
- No Output
What is the output of the C Program.?
int main()
{
if( 4 < 5 )
printf("Hurray..\n");
printf("Yes");
else
printf("England")
return 0;
}
- Hurray..Yes
- Hurray..
Yes - Compiler error
- None of the above
What is the output of the C Program.?
int main()
{
if( 10 < 9 )
printf("Hurray..\n");
else if(4 > 2)
printf("England");
return 0;
}
- England
- Hurray..
- Compiler error for missing else
- None of the above
What is the output of C Program.?
int main()
{
if( 10 > 9 )
printf("Singapore\n");
else if(4%2 == 0)
printf("England\n");
printf("Poland");
return 0;
}
- Singapore
- Singapore
Poland - Singapore
England
Poland - England
Poland
What is the output of the C Program.?
int main()
{
if(-5)
{
printf("Germany\n");
}
if(5)
{
printf("Texas\n");
}
printf("ZING");
return 0;
}
- ZING
- Texas
ZING - Germany
Texas
ZING - Compiler error as a number can not be put as condition inside IF.
What is the output of the C Program.?
int main()
{
if(10.0)
{
printf("Texas\n");
}
printf("ZING");
return 0;
}
- ZING
- Texas
ZING - Compiler error.
- None of the above.
What is the output of C Program.?
int main()
{
int x=1;
float y = 1.0;
if(x == y)
{
printf("Polo\n");
}
if( 1 == 1.0)
{
printf("Golf\n");
}
if( 1.0 == 1.0f )
{
printf("Boxing\n");
}
return 0;
}
- No Output
- Boxing
- Golf
Boxing - Polo
Golf
Boxing
What is the output of C Program.?
int main()
{
int a=9;
if(a=8)
{
printf("Kangaroo\n");
}
printf("Eggs\n");
return 0;
}
- No output
- Eggs
- Kangaroo
Eggs - Compiler error
What is the output of C Program.?
int main()
{
int a=9;
if(a==5);
{
printf("Kangaroo\n");
}
printf("Eggs\n");
return 0;
}
- Eggs
- Kangaroo
Eggs - No output
- Compiler error
What is the output of C Program.?
int main()
{
int a=9;
if(a==9);
{
printf("Ostrich\n");
}
elseif(a==8)
{
printf("Eggs\n");
}
printf("White");
return 0;
}
- White
- Ostrich
White - No Ouput
- Compiler error
What is the output of C Program.?
int main()
{
int a=9;
if(a==9)
{
printf("Ostrich\n");
}
else;
{
printf("Eggs\n");
}
printf("White");
return 0;
}
- White
- Ostrich
White - Ostrich
Eggs
White - Compiler Error
What is the output of C Program.?
int main()
{
int a=9, b=6;
if(a==9 && b==6)
{
printf("Hockey");
}
else
{
printf("Cricket");
}
return 0;
}
- Cricket
Football - Hockey
Football - Football
- Compiler error
Choose a correct C Statement.
- Nesting of ? : operator is possible
- int main()
{
int a=5, b=8;
if( a>=5 || (b=9) )
{
printf("Gorilla Glass");
}
return 0;
}
//OUTPUT: Gorilla Glass - int main()
{
int a=5, b=8;
if( a>=5 || (b<=9) )
{
printf("Gorilla Glass");
}
return 0;
}
//OUTPUT: Gorilla Glass - All the above