Question E7A07:
What logical operation does a NAND gate perform?  

Choices:  
A: It produces a 0 at its output only if all inputs are 0  
B: It produces a 1 at its output only if all inputs are 1  
C: It produces a 0 at its output if some but not all inputs are 1  
D: It produces a 0 at its output only if all inputs are 1    

Correct Answer is  D: It produces a 0 at its output only if all inputs are 1  

NAND = NOT AND. A NAND gate inverts the output of an AND gate.

1) Why the correct answer is correct
- Definition: For inputs $A, B$, a NAND outputs $Y = \overline{A \land B}$.
- Therefore, $Y = 0$ only when $A = 1$ and $B = 1$ (i.e., all inputs are 1). In every other case, $Y = 1$.
- Two-input truth pattern: 00 → 1, 01 → 1, 10 → 1, 11 → 0.

2) Why the other choices are incorrect
- A: “0 only if all inputs are 0” describes an OR gate behavior (OR is 0 only when all inputs are 0), not NAND.
- B: “1 only if all inputs are 1” is an AND gate, not NAND.
- C: “0 if some but not all inputs are 1” matches an XNOR for two inputs (or parity-related behavior), not NAND.

3) Useful formulas and rules of thumb
- NAND operation (2 inputs): $Y = \overline{A \cdot B}$.
- General $n$-input NAND: $Y = \overline{\prod_{i=1}^{n} X_i}$.
- De Morgan’s equivalence: $\overline{A \land B} = \overline{A} \lor \overline{B}$.
- Rule of thumb: A NAND outputs 1 unless all inputs are 1.