Logic Gates and Truth tables
Logic Gates and Truth tables
OF
COMPUTATIONAL
THINKING AND PROGRAMMING
0 0 0
A
Q 1 1 1
B
AND Truth Table
0 0 0
Q=A∧B 1 1 1
where ∧ represents AND AND Truth Table
A
Q
B
NOT gate
representation
NOT Gate (negation)
A
B Q
OR gate representation
OR Gate (disjunction)
1. For the OR gate, if A is 0 and B is 1,
what is Q?
2. For the OR gate, if A is 1 and B is 1,
what is Q? A
B Q
3. For the OR gate, if A is 1 and B is 0,
what is Q?
OR gate representation
XOR Gate (exclusive
disjunction)
• The XOR gate will display output as A B Q
True if either the A or B input but not
0 0 0
when both are True. (Compare to OR
gate) 0 1 1
• The Boolean expression for the XOR
1 0 1
Gate is
Q=A⊻B 1 1 0
Q = A ⊻ B is the same as
A
Q = (A ∧ ¬B) ∨ (¬A ∧ B) Q
B
XOR gate representation
XOR Gate (exclusive disjunction)
0, what is Q?
NAND Gate (alternative denial)
A B C Q
A 0 0 0 0
B Q 0 0 1 1
C 0 1 0 0
1. We need to combine 1 0 0 0
the AND gate with the 1 0 1 1
OR gate to represent
the condition below 1 1 0 1
1 1 1 1
If it is sunny AND if it is warm, 2. Just like any algebraic equation, the A
OR if it is my birthday, and B condition needs to be evaluated
I am going to go to the beach first, then we evaluate the C
The expression for this logic table will
look like this: Q = (A ∧ B) ∨ C
Learning outcomes
1. We reviewed the idea of ‘Boolean logic’
2. We connected the idea of Binary logic to binary
number system and decision-making in computing
systems
3. We explored more types of logic gates,
their functions, representations and truth tables
4. We reviewed how two or more logic gates could be
connected to form a logic circuit
Revising ideas from today’s session