WorksheetscodePannu Level 1 Python Course - Week 6 Quiz on Logical Operators
Total questions: 15
Worksheet time: 8mins
What is an example of a logical operator
and
if
else
elif
Which of the following is not a boolean expression?
TRUE
3==4
3+4
3+4==7
What Python does when we use the and operator?
Python does not evaluate the second condition when the first condition is false.
Python does not evaluate the first condition when the second condition is true.
Python does not evaluate the second condition when the first condition is true.
Python does not evaluate the first condition when the second condition is false
What will be the output of the following Python code ?
(10<20) and (10>30)
True
False
Error
OR operators are true if...
At least one condition is true
Both conditions are always true
All conditions are false
print(9>2 and 6<=6)
True
False
print(2%2==0 or 3%2==0)
True
False
Invalid Output
a = 10
b = 12
c = 0
print(a and b and c)
0
1
10
12
a = 10
b = 12
c = 0
print(a or b or c)
10
0
12
x = 10
y = 20
print(not(x == 10 and y == 20))
print(not(x == 3 or y == 20))
False
False
False
True
TRUE
False
True
True
x = "Hello World"
print(x)
print('x')
Hello World
x
x
Hello World
x
Error
x = 10
y = 20
print(not(x == 10 or y == 20))
print(not(x == 3 and y == 20))
False
True
True
True
False
False
Error
AbCdE, DeFgH, GhIjK, JkLmN, ?
OpQrS
NoPqR
MnOpQ
LmNoP
Which month of the year has 28 days?
February
December
Leap Year
All Months
a=10
b=19
print(a and b)
10
19
Error
1019
