24 total
By the end of this topic, you should be able to:
Boolean logic is a way of making decisions using TRUE or FALSE values. In computer science, we use 1 to represent TRUE and 0 to represent FALSE.
Computers use Boolean logic all the time to make decisions. For example:
Boolean logic uses inputs (the information going in) and outputs (the result that comes out). We give letters to represent them, like A, B, C for inputs and P, Q, X for outputs.
Logic gates are simple circuits that take one or two inputs and produce one output based on a rule. Think of them as tiny decision-makers inside a computer.
There are six main logic gates you need to know: NOT, AND, OR, XOR, NAND, and NOR.
Each logic gate has:
Symbol: A triangle with a small circle at the tip
Function: The NOT gate reverses the input. It has only one input (unlike the others which have two).
Rule:
Truth Table:
| A | NOT A |
|---|---|
| 0 | 1 |
| 1 | 0 |
Example: Think of it like a switch that does the opposite. If you say "the door is open" (input = 1), NOT gate says "the door is NOT open" (output = 0).
Symbol: A flat back with a rounded front (D-shape)
Function: The AND gate outputs TRUE (1) only if BOTH inputs are TRUE. If either input is FALSE, the output is FALSE.
Rule:
Truth Table:
| A | B | A AND B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Example: "The alarm sounds if the door is open AND it's nighttime." Both conditions must be true.
Sign in to view full notes