0 · Recall Warm-up
Answer from memory first. Answers are in the Answer Vault at the bottom.
- What does a ⊕ b give when a and b are equal? from Lesson 1.1.2
- What is the 3-bit Gray code of 5? from Lesson 1.2.1
- How many patterns do n bits have? from Lesson 0.1.1
1 · The Hook
🎣
A burglar alarm should ring if the door or the window opens, but only when the alarm is switched on. That sentence is already a circuit: an OR followed by an AND. Logic gates are tiny circuits that compute AND, OR, NOT and their relatives on bits. Every computer is built from them, and every GATE Digital Logic question starts from their truth tables.
2 · Predict First
🤔
A gate has two inputs A and B and outputs 1 only when both are 1. Fill in its output for the four input pairs 00, 01, 10, 11.
Make a guess in your head. The answer opens Section 3.
3 · Core Concept
💡
Predict First — the answer
0, 0, 0, 1. This is the AND gate.
🗣️
In plain words
A logic gate takes one or more bits and produces one bit. Its behaviour is fully described by a truth table: one row for every combination of inputs, and the output for each. Writing the same thing as a formula gives a Boolean expression, where AND is written like multiplication, OR like addition and NOT with a dash (').
1. The seven basic gates
| A B | AND AB | OR A + B | NAND (AB)' | NOR (A + B)' | XOR A ⊕ B | XNOR (A ⊕ B)' |
|---|---|---|---|---|---|---|
| 0 0 | 0 | 0 | 1 | 1 | 0 | 1 |
| 0 1 | 0 | 1 | 1 | 0 | 1 | 0 |
| 1 0 | 0 | 1 | 1 | 0 | 1 | 0 |
| 1 1 | 1 | 1 | 0 | 0 | 0 | 1 |
NOT (inverter): A' = 1 when A = 0, and 0 when A = 1. Quick descriptions:
- AND: 1 only if all inputs are 1. OR: 1 if at least one input is 1.
- NAND / NOR: AND / OR followed by NOT. NOR is 1 only when all inputs are 0.
- XOR: 1 when the inputs differ; with many inputs, 1 when an odd number of inputs are 1 (the parity of Lesson 1.2.1). XNOR: 1 when they are equal.
2. Truth table of an expression
An expression with n variables has a truth table with 2ⁿ rows. Work column by column. F = AB + C':
| A B C | AB | C' | F |
|---|---|---|---|
| 0 0 0 | 0 | 1 | 1 |
| 0 0 1 | 0 | 0 | 0 |
| 0 1 0 | 0 | 1 | 1 |
| 0 1 1 | 0 | 0 | 0 |
| 1 0 0 | 0 | 1 | 1 |
| 1 0 1 | 0 | 0 | 0 |
| 1 1 0 | 1 | 1 | 1 |
| 1 1 1 | 1 | 0 | 1 |
F is 1 in rows 0, 2, 4, 6 and 7 (rows numbered by the binary value of ABC).
3. Order of operations
NOT first, then AND, then OR (like minus sign, ×, + in arithmetic). AB + C' means (A·B) + (C'). Use brackets to change it: A(B + C).
4. From circuit to expression
Label each gate's output with its expression, working from the inputs to the output. The circuit in the figure below gives AB from the AND gate, C' from the NOT gate, and AB + C' from the OR gate.
4 · Visual
The standard gate symbols. A small circle (bubble) on the output means "then NOT".
The circuit for F = AB + C'.
5 · Worked Examples
Example 1 Easy
What is the output of a 3-input XOR gate for inputs 1, 1, 1?
Solution
Three 1s is an odd number → 1.
Example 2 Medium
Write the truth table of F = A'B + AC and list the rows (as ABC numbers) where F = 1.
Solution
A'B is 1 in rows 2, 3; AC in rows 5, 7 → F = 1 in rows 2, 3, 5, 7.
Example 3 GATE
How many rows does the truth table of a function of 5 variables have?
Solution
2⁵ = 32.
6 · GATE Traps
⚠️
- NAND is not "NOT A AND NOT B": (AB)' differs from A'B' (check row 01).
- Multi-input XOR is a parity check (odd number of 1s), not "exactly one input is 1".
- NOT binds tightest, then AND, then OR.
- Rows are numbered by the binary value of the inputs with the first variable as the MSB.
7 · Memory Hook
🧠
"AND all, OR any, XOR odd; a bubble means NOT."
8 · Connect the Dots
Truth tables describe a function completely but grow fast. The next lesson gives the laws of Boolean algebra, which let you simplify an expression on paper before building it.
9 · Self-Test
GATE format. Try every question before opening the vault.
Q1MCQ1 markGates
Which gate outputs 1 only when all its inputs are 0?
- (A) NOR
- (B) AND
- (C) XNOR
- (D) NAND
Q2NAT1 markXOR
What is the output of a 4-input XOR gate for inputs 1, 0, 1, 1?
Numerical answer: ________
Q3NAT1 markRows
How many rows does the truth table of a 6-variable function have?
Numerical answer: ________
Q4NAT2 marksExpression
F(A, B, C) = AB + C'. In how many of the 8 rows is F = 1?
Numerical answer: ________
Q5MCQ1 markNAND
For inputs A = 0, B = 1, which expression equals 1?
- (A) AB
- (B) A'B'
- (C) (AB)'
- (D) A ⊙ B (XNOR)
10 · Rule Card
- AND: 1 iff all 1. OR: 1 iff any 1. NOT inverts. NAND = (AND)', NOR = (OR)'.
- XOR: 1 iff an odd number of inputs are 1; XNOR is its NOT.
- n variables → 2ⁿ truth-table rows, numbered by the input bits (first variable = MSB).
- Precedence: NOT, then AND, then OR.
11 · Concept Ledger
Unlocked in this lesson. From here on, these terms may be used.
logic gatetruth tableANDORNOT (inverter)NANDNORXORXNORBoolean expressionoperator precedencegate symbols and bubblescircuit to expression
12 · Answer Vault
Answer Vault
Try the questions first. Open when you are ready to check.
Recall Warm-up
-
-
- 2ⁿ.
Self-Test
Q1 Answer: (A)1 mark
NOT of OR: OR is 0 only when all inputs are 0.
- (B) is wrong: 1 only when all are 1.
- (C) is wrong: 1 when inputs are equal, including all 1s.
- (D) is wrong: 0 only when all are 1.
Re-read: Lesson 3.1.1 — Logic gates and truth tables
Q2 Answer: 11 mark
Three 1s: odd.
Re-read: Lesson 3.1.1 — Logic gates and truth tables
Q3 Answer: 641 mark
2⁶.
Re-read: Lesson 3.1.1 — Logic gates and truth tables
Q4 Answer: 52 marks
Rows 0, 2, 4, 6, 7.
Re-read: Lesson 3.1.1 — Logic gates and truth tables
Q5 Answer: (C)1 mark
AB = 0, so its NOT is 1.
- (A) is wrong: 0.
- (B) is wrong: B' = 0.
- (D) is wrong: Inputs differ.
Re-read: Lesson 3.1.1 — Logic gates and truth tables