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;
}
A
60
B
65
C
1
D
0
Question 1 Explanation: 
  1. ASCII Value of 'A' is 65.
  2. 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)
A
False
B
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.
A
True
B
False
Question 4
In the expression a = b = 100 the order of Assignment is decided by Associativity of operators !
A
False
B
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 !
A
True
B
False
Question 5 Explanation: 
Comma Operator has left to right associativity.
There are 5 questions to complete.