Resources | Subject Notes | Computer Science
This section focuses on understanding logic gates and how to construct their truth tables. A truth table systematically lists all possible input combinations for a logic gate and the corresponding output for each combination. This is a fundamental skill in digital logic.
The AND gate outputs a 1 (True) only when both inputs are 1 (True). If either or both inputs are 0 (False), the output is 0 (False).
Input A | Input B | Output |
---|---|---|
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
The OR gate outputs a 1 (True) if either one or both of its inputs are 1 (True). The output is 0 (False) only when both inputs are 0 (False).
Input A | Input B | Output |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
The NOT gate (also known as the inverter) inverts the input. If the input is 1 (True), the output is 0 (False), and vice versa.
Input | Output |
---|---|
0 | 1 |
1 | 0 |
The NAND gate is the inverse of the AND gate. It outputs 0 (False) only when both inputs are 1 (True). If either or both inputs are 0 (False), the output is 1 (True).
Input A | Input B | Output |
---|---|---|
0 | 0 | 1 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
The NOR gate is the inverse of the OR gate. It outputs 1 (True) only when both inputs are 0 (False). If either or both inputs are 1 (True), the output is 0 (False).
Input A | Input B | Output |
---|---|---|
0 | 0 | 1 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 0 |
The XOR (exclusive OR) gate outputs 1 (True) if its inputs are different. It outputs 0 (False) if its inputs are the same.
Input A | Input B | Output |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
The XNOR (exclusive NOR) gate is the inverse of the XOR gate. It outputs 1 (True) if its inputs are the same, and 0 (False) if they are different.
Input A | Input B | Output |
---|---|---|
0 | 0 | 1 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
These truth tables demonstrate the behavior of basic logic gates. Understanding these fundamental gates is crucial for building more complex digital circuits.