
if, elif, and else Conditionals
Authored by Bryan Campbell
Computers
9th - 12th Grade
Used 13+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the purpose of the if statement in Python?
To declare a variable
To loop through a sequence
To perform conditional execution of code
To define a function
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
How many possible values are there for a boolean variable?
1
2
3
4
3.
MULTIPLE CHOICE QUESTION
1 min • 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.
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
In Python, how is the if statement terminated?
With a semicolon
With a colon
With a period
With an exclamation mark
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following is not a logical operator in Python?
and
or
not
because
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following programs will run but will not print anything?
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Mr. Ramesh is writing a Python program to check if Carlos and Charlie have both completed their homework. He wants to use the and operator in an if statement. What is the purpose of the and operator in this context?
It is used for bitwise operations
It combines two conditions, and both must be true for the if statement to execute
It is used to exit a loop
It is used for logical negation
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
15 questions
Networking Quiz
Quiz
•
8th - 9th Grade
15 questions
Arduino
Quiz
•
7th - 9th Grade
20 questions
Ôn tập học kỳ I
Quiz
•
9th - 12th Grade
15 questions
Asesmen Sumatif
Quiz
•
12th Grade
20 questions
Informatika
Quiz
•
10th Grade
17 questions
Traffic Light Project Quiz
Quiz
•
9th Grade
15 questions
History of Computers
Quiz
•
6th - 12th Grade
15 questions
Vocabulary of Computer
Quiz
•
12th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade