1.
The Boolean expression (x==y && !(x==y)) || ( x!=y && !(x!=y)) can be simplified to which of the following?
-
x != y
-
If we assume that x is not equal to y then the expression is (false && true) || (true && false) which is false.
-
x == y
-
If we assume that x == y is the same than using it in the full expression should return true. But, if x is equal to y you would get (true && false) || (false && true) which is false.
-
true
-
How can this be true? Remember that && requires both expressions to be true in order to return true. You can think of (x==y && !(x==y)) as A && !A which is always false. You can think of ( x!=y && !(x!=y) as B && !B which is always false.
-
false
-
This can be simplified to (A && !A) || (B && !B) which is (false || false) which is false. You can think of (x==y && !(x==y)) as A && !A which is always false. You can think of ( x!=y && !(x!=y) as B && !B which is always false.
-
x < y
-
Since this expression is only about equality how could this be true?

