Boolean Logic

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Boolean Logic

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What does True and False return?
A False
B True
2. What does True or False return?
A False
B True
3. What does not True return?
A False
B True
4. What does False and False return?
A False
B True
5. What does False or True return?
A False
B True

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1if x > 0 AND x < 10: AOutput: True
2result = true BValid: Both must be True
3x > 0 and x < 10 COutput: False
4not False DError: Use lowercase 'and'
5print(True or False) EError: Use True not true
6print(True and False) FOk: Returns True

Definitions

Boolean

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
print(True ___ True)
2.
print(True __ False)
3.
print(___ False)
4.
print(5 > 3 ___ 2 < 10)
5.
print(___ (10 == 5))

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A x = True
B print(true and false)
C print(x)
Question 2
A a = True
B print(True AND False)
C b = False
Question 3
A x = True
B print(True & False)
C print(x)
Question 4
A a = False
B print(True | False)
C print(a)
Question 5
A x = TRUE
B print(x)
C print(not x)

Answer Key

Boolean Logic
Section A: Quick Questions
Q1
A — False
Q2
B — True
Q3
A — False
Q4
A — False
Q5
B — True
Section B: Match the Pairs
Q1
if x > 0 AND x < 10: → Error: Use lowercase 'and'
Q2
result = true → Error: Use True not true
Q3
x > 0 and x < 10 → Valid: Both must be True
Q4
not False → Ok: Returns True
Q5
print(True or False) → Output: True
Q6
print(True and False) → Output: False
Section C: Definitions
Q1
Boolean — A data type with only two values: True or False.~~and
Section D: Fill in the Blanks
Q1
print(True and True)
Q2
print(True or False)
Q3
print(not False)
Q4
print(5 > 3 and 2 < 10)
Q5
print(not (10 == 5))
Section E: Spot the Error
Q1
B — Booleans must be capitalized True and False, not true and false
Q2
B — Boolean operators are lowercase and, not AND
Q3
B — Use the word 'and', not the & symbol
Q4
B — Use the word 'or', not the | symbol
Q5
A — Python Booleans use title case True not all caps TRUE