C Programming MCQ : Conditional Operators (Multiple Choice Questions)
Question 1 |
Guess the output of the following code ?
#include<stdio.h> int main() { int k; k = 'A' > 60; printf("%d\n", k); return 0; }
60 | |
65 | |
1 | |
0 |
Question 1 Explanation:
- ASCII Value of 'A' is 65.
- While comparing 'A' with 60 , Actual comparison of ASCII Value is evaluated. 65 is greater than 60 thus it returns true.
Question 2 |
The expression of the right hand side of && operators get evaluated only if the left hand side expression is true. (Say True/False)
False | |
True |
Question 2 Explanation:
(A && B)If A is true then and then only expression B is evaluated.
Question 3 |
Associativity of an operator is either Left to Right or Right to Left.
True | |
False |
Question 4 |
In the expression a = b = 100 the order of Assignment is decided by Associativity of operators !
False | |
True |
Question 4 Explanation:
The equal to = operator has Right to Left Associativity. Above expression is equivalent to -
b = 100; a = b;
Question 5 |
Comma Operator returns rightmost operand !
True | |
False |
Question 5 Explanation:
Comma Operator has left to right associativity.
There are 5 questions to complete.