
Understanding Python Conditionals
Quiz
•
Computers
•
11th Grade
•
Practice Problem
•
Medium
Kavita Bhagat
Used 1+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code: if x > 10: print('Greater') elif x < 10: print('Lesser') else: print('Equal')?
Greater
Undefined
Lesser
Equal
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Write a Python program using if-elif-else to check if a number is positive, negative, or zero.
number = int(input('Enter a number: ')) if number < 0: print('Zero') elif number > 0: print('Negative') else: print('Positive')
number = float(input('Enter a number: ')) if number >= 0: print('Zero') else: print('Positive')
number = float(input('Enter a number: ')) if number > 0: print('Positive') elif number < 0: print('Negative') else: print('Zero')
number = input('Enter a number: ') if number == 0: print('Positive') else: print('Negative')
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How does the if statement differ from the if-elif-else statement in Python?
The 'if' statement is used for defining functions.
The 'if' statement checks one condition, while 'if-elif-else' checks multiple conditions in sequence.
The 'if-elif-else' statement is used for loops only.
The 'if' statement can check multiple conditions at once.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be printed if x = 5 in the following code: if x > 10: print('High') elif x == 5: print('Medium') else: print('Low')?
Very High
Low
High
Medium
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Create a conditional statement that checks if a student has passed based on their marks (pass mark is 40).
if (marks < 40) { return 'Passed'; } else { return 'Failed'; }
if (marks == 40) { return 'Failed'; } else { return 'Passed'; }
if (marks > 40) { return 'Failed'; } else { return 'Passed'; }
if (marks >= 40) { return 'Passed'; } else { return 'Failed'; }
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Explain the use of the else statement in an if-elif-else structure.
The 'else' statement provides a default action when all other conditions fail.
The 'else' statement can only be used with a single if condition.
The 'else' statement is used to replace the if statement entirely.
The 'else' statement is only executed if the first condition is true.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code: if a == b: print('Equal') elif a > b: print('A is greater') else: print('B is greater')?
A is always greater
B is always greater
Equal regardless of values
Depends on the values of a and b
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
Паскаль. Основные команды
Quiz
•
8th - 11th Grade
10 questions
CyberCrime
Quiz
•
5th Grade - Professio...
10 questions
Excel
Quiz
•
10th - 11th Grade
13 questions
اختبار تشخيصي قبلي
Quiz
•
11th - 12th Grade
15 questions
Javascript Quiz 2
Quiz
•
11th Grade
15 questions
J808 LO1 and LO2 planning project keywords / terms
Quiz
•
9th - 11th Grade
11 questions
CompTIA A+February27
Quiz
•
11th Grade
10 questions
Social media influencers
Quiz
•
6th - 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
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
