Sign in

Intro to Computer Science / Unit 5: Conditionals and Boolean Logic

5.4 Truth Tables

3 practice questionsNot yet reviewed

Notes

A truth table lists every combination of inputs and the result.

ABA and BA or B
TrueTrueTrueTrue
TrueFalseFalseTrue
FalseTrueFalseTrue
FalseFalseFalseFalse
  • not A is the opposite of A.
  • De Morgan's laws: not (A and B) equals (not A) or (not B), and not (A or B) equals (not A) and (not B).
  • With 2 inputs there are 4 rows; with 3 inputs there are 8 rows (2 to the power of the number of inputs).

Practice

For which input does A or B give False?
How many rows does a truth table for three inputs A, B and C have?
Which expression is equivalent to not (x > 5 and y > 5)?

Ready for more? Take the Unit 5 test.