
Python Logical Operators Quiz

Quiz
•
Other
•
9th Grade
•
Medium
Emilio Gasca
Used 10+ times
FREE Resource
9 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is not a logical operator in Python?
A. and
B. or
C. not
D. because
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following conditions tell me to sleep if my alarm did not go off (alarm = False) and I’m tired (tired = True)?
A. if alarm and tired: sleep
B. if not alarm or tired: sleep
C. if not alarm and tired: sleep
D. if not alarm and not tired: sleep
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Assume you are writing a program, and you have a boolean variable called b, defined like so: b = True. Pick the correct if statement to follow the code above. The if statement should be correct Python, and the body of the if statement should only run if b is True.
A. if b: print("b is True!")
B. if b: print("b is True!")
C. if True: print(b)
D. if True: print(b)
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following programs will run but will not print anything?
A. x = True if x: print("hi")
B. if False: print("hi")
C. x = False if x: print("hi") else: print("hello")
D. if True:
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following evaluates to the variable x rounded to two decimal places?
round(x, 2)
round(2, x)
round(x), 2
round(2), x
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following values is rounded to 3 decimal places?
2.3
3.000
3.0001
3
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does this Python expression evaluate to? 100 != 100
True
False
“True”
“False”
8.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is not a comparison operator?
<=
!=
?
>
9.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many possible values are there for a boolean variable?
1
2
3
There is an infinite number of possibilities.
Similar Resources on Wayground
5 questions
Conditionals and Comparisons Quiz

Quiz
•
KG - 12th Grade
10 questions
What's that sound?

Quiz
•
6th - 12th Grade
10 questions
2850-201 (3)

Quiz
•
KG - Professional Dev...
10 questions
Drum Brakes

Quiz
•
9th - 12th Grade
8 questions
Piggy Hard Quiz

Quiz
•
KG - 12th Grade
10 questions
Workplace Readiness Skills - IC Practice #1

Quiz
•
9th - 12th Grade
10 questions
Semester 1 - 9th grade

Quiz
•
9th Grade
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Other
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
24 questions
Scientific method and variables review

Quiz
•
9th Grade
20 questions
Getting to know YOU icebreaker activity!

Quiz
•
6th - 12th Grade
20 questions
Biomolecules

Quiz
•
9th Grade
12 questions
Graphing Inequalities on a Number Line

Quiz
•
9th Grade
20 questions
Cell Organelles

Quiz
•
9th Grade
20 questions
Oceans and Continents Quiz

Quiz
•
9th Grade