Gerbang logik
Diperkenalkan
8:32
Logika Boolean
Perhatikan chip ini dengan saksama. Tidak ada kecerdasan di dalamnya. Ia tidak bisa berpikir. Di dalamnya terdapat jutaan sakelar kecil, dan setiap sakelar hanya dapat berada dalam salah satu dua keadaan…
Narasi bahasa Inggris · takarir bahasa Inggris dan 中文 yang dapat dipilih
In this lesson
| English | Makna |
|---|---|
| Boolean logic/ˈbuːlɪən ˈlɒdʒɪk/ | |
| logic gate/ˈlɒdʒɪk ɡeɪt/ | gerbang logika |
| truth table/truːθ ˈteɪbl/ | tabel kebenaran |
| inverted/ɪnˈvɜːtɪd/ | terbalik |
The building blocks of circuits
- Boolean logic 布尔逻辑 works with values that are true (1) or false (0).
- A logic gate 逻辑门 takes inputs and gives one output by a fixed rule.
- A truth table 真值表 lists every input combination and its output.
The six gates
- You must know six: NOT, AND, OR, NAND, NOR, XOR.
- NOT has one input; the rest have two. A small circle on the output means inverted 取反 (NOT, NAND, NOR).


Gerbang logik
output from the truth table
Toggle A and B through each gate and read the result off the truth table.
NOT, AND, OR
- NOT reverses the input. AND is 1 only when both inputs are 1. OR is 1 when at least one input is 1.
| A | B | A AND B | A OR B |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 |
(NOT: 0→1, 1→0.)


An AND gate gives output 1 when:
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
AND outputs 1 only when every input is 1.
An OR gate gives output 0 only when:
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
OR is 1 if at least one input is 1, so it is 0 only when both are 0.
NAND, NOR, XOR
- NAND = opposite of AND; NOR = opposite of OR; XOR = 1 when the inputs are different.
| A | B | A NAND B | A NOR B | A XOR B |
|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 0 | 0 |
A XOR gate gives output 1 when:
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
XOR (exclusive OR) is 1 when the inputs differ.
Match each gate to when its output is 1.
Kesulitan 2/5 · 140 koin + bonus kecil pada penyelesaian pertama hari ini
AND = all 1s, OR = any 1, XOR = inputs differ, NAND = NOT AND.
A NOR gate with both inputs 0 gives what output (0 or 1)?
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
NOR = NOT OR. OR of (0,0) is 0, so NOR is 1. NOR is 1 only when both inputs are 0.
Worked example: XOR from its truth table
Complete the truth table for X = A XOR B, and compare it with OR.
| A | B | A OR B | A XOR B |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 1 | 0 |
- XOR gives 1 when the inputs are different, and 0 when they are the same. It only differs from OR in the last row, where both inputs are 1.
- NAND and NOR are AND and OR followed by NOT, so every output in their columns is flipped.
What is the output of a NAND gate when A = 1 and B = 1?
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
1 AND 1 = 1, and NOT 1 = 0.
A NOR gate outputs 1 only when both inputs are 0.
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
OR gives 0 only for 0, 0; NOT then turns it into 1.
You've got it
- 1 = true, 0 = false; a truth table lists every input combination
- AND = both 1 · OR = at least one 1 · NOT = invert
- NAND/NOR = AND/OR with the output inverted (the circle)
- XOR = 1 when the inputs differ