GATE 2015 CS – Question 40
The binary operator $\neq$ is defined by the following truth table.
| $p$ | $q$ | $p \neq q$ |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Which one of the following is true about the binary operator $\neq$?
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (A) Both commutative and associative
Explanation
The table gives the exclusive-OR operation. Swapping $p$ and $q$ does not change the output, so it is commutative. Exclusive-OR is also associative, since $(p \oplus q) \oplus r$ and $p \oplus (q \oplus r)$ are both 1 exactly when an odd number of the three inputs are 1.