CS: Boolean Logic and Logic Gates
Using true and false values to model digital decisions
CS: Boolean Logic and Logic Gates
Using true and false values to model digital decisions
CS - Grade 6-8
- 1
In Boolean logic, a value can be either true or false. A variable A is true. What is NOT A?
NOT means the opposite of the given value.
NOT A is false because the NOT operator changes a Boolean value to its opposite. - 2
Evaluate the expression: true AND false.
The expression true AND false is false because an AND expression is true only when both inputs are true. - 3
Evaluate the expression: true OR false.
OR needs one or more true inputs.
The expression true OR false is true because an OR expression is true when at least one input is true. - 4
Complete this truth table for A AND B: A = true, B = true. What is the output?
The output is true because both A and B are true, and an AND gate outputs true only when all inputs are true. - 5
Complete this truth table for A AND B: A = true, B = false. What is the output?
For AND, every input must be true.
The output is false because one input is false, and an AND gate needs both inputs to be true. - 6
Complete this truth table for A OR B: A = false, B = false. What is the output?
The output is false because both inputs are false, and an OR gate needs at least one true input. - 7
Complete this truth table for A OR B: A = false, B = true. What is the output?
For OR, one true input is enough.
The output is true because B is true, and an OR gate outputs true if at least one input is true. - 8
A light turns on only when switch A is on and switch B is on. Which logic gate models this rule: AND, OR, or NOT?
The AND gate models this rule because the light turns on only when both switch A and switch B are on. - 9
A school website allows login if a user has a password OR a one-time code. Which logic gate models this rule: AND, OR, or NOT?
The word or in the rule is a clue.
The OR gate models this rule because the user can log in when at least one of the two conditions is true. - 10
Evaluate the expression: NOT false AND true. Use normal order where NOT happens before AND.
The expression is true. NOT false becomes true, and then true AND true equals true. - 11
Evaluate the expression: NOT (true OR false).
Solve inside the parentheses first.
The expression is false. First, true OR false equals true, and then NOT true equals false. - 12
A game door opens when a player has a key AND has completed the puzzle. If hasKey = true and puzzleComplete = false, does the door open? Explain using Boolean logic.
The door does not open because true AND false equals false. Both conditions must be true for the door to open.