
Python If-Else Quiz
Quiz
•
Computers
•
5th Grade
•
Practice Problem
•
Medium
Seba Robert
Used 39+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the syntax for an if-else statement in Python?
if condition:
code to be executed if the condition is true
else:
code to be executed if the condition is false
if condition:
code to be executed if the condition is true
else if condition:
code to be executed if the condition is false
if condition:
code to be executed if the condition is true
code to be executed if the condition is false
if condition:
code to be executed if the condition is true elif condition:
code to be executed if the condition is false
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many conditions can be checked in a single if-else statement?
4
3
2
1
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the else statement in an if-else statement?
To provide an alternative set of instructions when the condition in the if statement is false.
To skip the if statement and move to the next statement.
To execute the same set of instructions as the if statement.
To terminate the execution of the program.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which operator is used to check for equality in an if-else statement?
<>
!=
==
===
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What happens if the condition in an if statement is False?
The code block inside the if statement will be executed twice.
The code block inside the if statement will still be executed.
The code block inside the if statement will throw an error.
The code block inside the if statement will be skipped.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code? x = 5 if x > 10: print('Greater than 10') else: print('Less than or equal to 10')
Greater than 10
Equal to 10
Greater than or equal to 10
Less than or equal to 10
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code? x = 10 if x == 10: print('Equal to 10') else: print('Not equal to 10')
Equal to 10
Greater than 10
Not equal to 10
Equal to 5
Create a free account and access millions of resources
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
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
15 questions
4:3 Model Multiplication of Decimals by Whole Numbers
Quiz
•
5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
The Best Christmas Pageant Ever Chapters 1 & 2
Quiz
•
4th Grade
12 questions
Unit 4 Review Day
Quiz
•
3rd Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
