GATE Computer ScienceHardGATE CS (PYQ pattern)

A Boolean function is affine if it equals c ⊕ (XOR of some subset of its variables) for a constant c, and self-dual if f(x̄) = f(x)'. Among functions of four variables, how many are both affine and self-dual, and how many of those depend on all four variables?

  1. A. 16 and 2
  2. B. 32 and 2
  3. C. 8 and 0
  4. D. 16 and 0

Correct answer: D. 16 and 0

Complementing all inputs flips the XOR of a subset S exactly |S| times, so f(x̄) = f(x) ⊕ (|S| mod 2). Self-duality needs |S| odd: C(4,1) + C(4,3) = 8 subsets, times 2 constants = 16. Depending on all four variables would need |S| = 4, which is even, so none: 0.

More Digital Logic questions

Exams that ask this topic