Computational logic 2 Flashcards
boolean statements and truth tables
a boolean statement such as P = A AND B implies that P is only true if both A and B are true
it can be investigated using a truth table
using boolean statements to solve problems
boolean statements can be used to represent selection using relational operators used in programs
the statement:
if X == 9 AND Y == 6 then
is the same as P = A AND B/ an AND gate
the statement:
if X != 9 AND Y != 6 then
is equal to P = (NOT A) AND (NOT B)
Complete the truth table for the Boolean expression P = NOT(A AND B) [4]
A B P FALSE FALSE FALSE TRUE TRUE FALSE TRUE FALSE
B: TRUE
P: TRUE, TRUE, TRUE
Complete the truth table for the Boolean expression P = (NOT A) AND (NOT B) [4]
A B P FALSE FALSE FALSE TRUE TRUE FALSE TRUE FALSE
B: TRUE
P: TRUE, FALSE, FALSE
a) Complete a logic diagram for the equation P + NOT(A) AND B [2]
b) Complete the truth table for the logic circuit [3]
A B P 0 0 0 ? ? ?
a) input A into NOT gate that feeds into an AND gate
other input for AND gate is B
output for AND gate is P
b) A B P 0 0 0 0 1 1 1 0 0 1 1 0
An alarm system uses three switches. The alarm will sound if either switch A or switch B are in the ON position but only if the master switch C is in the ON position.
Draw a logic diagram and truth table for this system. [5]
inputs A and B into an OR gate that leads into an AND gate, the other input is C and the output is Q
A B C Q 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1