Python Booleans & Truth Values Quiz
A 35-question quiz covering boolean logic, truthy/falsy values, operators, and conditional expressions.
Question 1
What is the data type of the value `True` in Python?
Question 2
Analyze the code below. What will be the output?
print(True + True)Question 3
Which of the following values is considered 'falsy' in Python?
Question 4
What is the result of the expression `True and False`?
Question 5
Analyze the code below. What is the value of `result`?
x = 10
y = 20
result = x > 5 and y < 30Question 6
What does the `not` operator do?
Question 7
Consider the following expression using short-circuit evaluation. What is the final result?
result = True or (5 / 0)Question 8
What is the output of `bool([])`?
Question 9
Which comparison operator checks if two variables point to the exact same object in memory?
Question 10
Analyze the code below. What will be printed?
if "Hello":
print("Yes")
else:
print("No")Question 11
What is the result of `not 0`?
Question 12
Which of the following expressions evaluates to `True`?
Question 13
What is the precedence of boolean operators in Python (from highest to lowest)?
Question 14
Analyze the code below. What is the value of `x`?
x = 10 or 20Question 15
What is the result of `bool(None)`?
Question 16
Which statement correctly checks if a variable `is_valid` is False?
Question 17
What is the output of the following chained comparison?
x = 5
print(1 < x < 10)Question 18
What is the result of `True and 0`?
Question 19
Which of the following is equivalent to `bool(1)`?
Question 20
Analyze the code below. What is the output?
a = True
b = False
print(a or b and a)Question 21
What is the result of `False == 0`?
Question 22
Which logical operator requires both operands to be false to return False?
Question 23
What is the output of `bool(' ')` (a string with a single space)?
Question 24
Analyze the code below. What is the value of `check`?
check = (1, 2) == [1, 2]Question 25
What is the result of `any([False, False, True])`?
Question 26
What is the result of `all([True, True, 1])`?
Question 27
Which expression correctly checks if `x` is strictly between 10 and 20?
Question 28
What is the result of `not not 5`?
Question 29
Analyze the code below. What is printed?
if 0:
print("A")
elif []:
print("B")
else:
print("C")Question 30
What is the result of `True is not False`?
Question 31
Which value is returned by `1 and 2 and 3`?
Question 32
What is the result of `bool(range(0))`?
Question 33
Analyze the code below. What is the value of `flag`?
flag = "False" == FalseQuestion 34
Which of the following is the correct way to assign a boolean value to a variable?
Question 35
What is the result of `not (True or False)`?
