lenelex.com
Home
Quizzes
Games
Register
Log in
Question 1 of 20
What is the output of the following code snippet?
bool? a = false; bool? b = false; Console.WriteLine(a ^ b);
A. False
B. Null
C. True
Comparing nullable types
When you perform comparisons with nullable types, if the value of one of the nullable types is null and the other is not, all comparisons evaluate to false except for != (not equal). It is important not to assume that because a particular comparison returns false, the opposite case returns true.
Links:
The Logical XOR Operator
Using Nullable Types
Boolean Data Type