• S
    SwaseekhGATE Preparation
General
  • Dashboard
  • Syllabus
  • Questions
  • Aptitude
  • Mock Tests
  • TCS NQT 2026
Account
  • Pricing
  • Contact
  1. GATE CS
  2. PYQs
  3. Discrete Mathematics

The binary operator != is defined by the following truth table. p q | p != q : 0 0 -> 0 ; 0 1 -> 1 ; 1 0 -> 1 ; 1 1 -> 0. Which one of the following is true about the binary operator !=? A. Both commutative and associative B. Commutative but not associative C. Not commutative but associative D. Neither commutative nor associative

GATE 2015 · Discrete Mathematics · Binary Operation · easy

Answer: A. Both commutative and associative

  1. Read the operator as XOR: Outputs are 0,1,1,0 for inputs (0,0),(0,1),(1,0),(1,1) — output is 1 exactly when the bits differ, which is XOR.
  2. Test commutativity: Rows (0,1) and (1,0) both give 1, and (0,0),(1,1) are already symmetric, so swapping inputs never changes the output. Commutative.
  3. Test associativity: Both sides equal (p + q + r) mod 2 because addition modulo 2 can be regrouped. For example with p=1,q=1,r=1 both groupings give (1)!=1 = 0 vs 1!=(0) = 1... recompute: (1!=1)!=1 = 0!=1 = 1 and 1!=(1!=1) = 1!=0 = 1, equal.
  4. Conclude: Commutative and associative selects option A.