
Python If-Else Quiz
Authored by Seba Robert
Computers
5th Grade
Used 39+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
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
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
10 questions
Lekcja14
Quiz
•
3rd - 6th Grade
10 questions
Revision for HYE
Quiz
•
5th Grade
15 questions
Chủ đề 4: Thế giới Logo - Câu lệnh lặp lồng nhau
Quiz
•
5th Grade
10 questions
Moj prvi program 5.r
Quiz
•
5th Grade
14 questions
Алгоритми з розгалуженням. Скретч
Quiz
•
5th Grade
10 questions
Review PAT TIK kelas 5
Quiz
•
5th Grade
10 questions
Tuần 22- lớp 5
Quiz
•
1st - 5th Grade
10 questions
Scratch revisión de conocimiento
Quiz
•
3rd - 6th 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
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
20 questions
Figurative Language Review
Quiz
•
6th Grade