
Python 2 Conditionals Quiz
Quiz
•
Computers
•
12th Grade
•
Practice Problem
•
Medium
Jamisha McClain-Raymond
Used 1+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
1. Write a Python program to check if a number is positive, negative or zero using if-else statement.
num = float(input('Enter a number: ')) if num > 0: print('Positive number') elif num < 0: print('Negative number') else: print('Zero')
print('Positive number')
num = input('Enter a number: ')
if num >= 0:
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
2. Write a Python program to find the largest of three numbers using if-else statement.
if num1 >= num2 or num1 >= num3:
if num2 <= num1 or num2 <= num3:
if num1 <= num2 and num1 <= num3:
if num1 >= num2 and num1 >= num3: largest = num1 elif num2 >= num1 and num2 >= num3: largest = num2 else: largest = num3
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
3. Write a Python program to check if a number is even or odd using if-else statement.
if (num % 2 == 1): print('Even') else: print('Odd')
if (num / 2 == 0): print('Even') else: print('Odd')
if (num % 2 == 0): print('Even') else: print('Odd')
if (num % 2 != 0): print('Even') else: print('Odd')
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
4. Write a Python program to find the largest number among three numbers using nested conditionals.
if num2 > num3: largest = num2
if num1 > num2: if num1 > num3: largest = num1 else: largest = num3 else: if num2 > num3: largest = num2 else: largest = num3
if num1 > num2: largest = num1
if num1 > num3: largest = num1
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
5. Write a Python program to check if a number is positive, negative or zero using nested conditionals.
if num == 0: print('Positive') elif num < 0: print('Negative') else: print('Zero')
if num > 0: print('Negative') elif num < 0: print('Positive') else: print('Zero')
if num > 0: print('Positive') elif num < 0: print('Negative') else: print('Zero')
if num < 0: print('Positive') elif num > 0: print('Negative') else: print('Zero')
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
6. Write a Python program to check if a year is a leap year using nested conditionals.
if (year % 4 == 0): if (year % 100 == 0): if (year % 400 == 0): print(year, 'is a leap year') else: print(year, 'is not a leap year') else: print(year, 'is a leap year') else: print(year, 'is not a leap year')
if (year % 400 != 0): print(year, 'is a leap year')
if (year % 100 != 0): print(year, 'is not a leap year')
if (year % 4 != 0): print(year, 'is a leap year')
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
7. What will be the output of the following code? x = 5 y = 3 print(x > 3 and y < 5)
False
Error
None
True
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
10 questions
Pre tes dan Post test
Quiz
•
12th Grade
10 questions
MEDIA AND INFORMATION LITERACY
Quiz
•
12th Grade
10 questions
Bài 8- CĐ F-TH10
Quiz
•
9th - 12th Grade
13 questions
Алгоритмізація 2 частина клас 7 +підсумкова
Quiz
•
12th Grade
15 questions
Looping Review
Quiz
•
10th - 12th Grade
13 questions
Arrays in Swift
Quiz
•
10th - 12th Grade
10 questions
Avaliação Pensamento Computacional - Prático
Quiz
•
1st Grade - Professio...
15 questions
Network Advantages and Disadvantages
Quiz
•
10th Grade - University
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th 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
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
Discover more resources for Computers
26 questions
Christmas Movie Trivia
Lesson
•
8th Grade - Professio...
15 questions
Christmas Song Emoji Pictionary
Quiz
•
7th - 12th Grade
20 questions
Christmas Movies
Quiz
•
1st - 12th Grade
55 questions
CHS Holiday Trivia
Quiz
•
12th Grade
20 questions
Christmas Movie Trivia
Quiz
•
9th - 12th Grade
29 questions
christmas facts
Lesson
•
5th - 12th Grade
20 questions
Christmas Trivia
Quiz
•
5th - 12th Grade
20 questions
Stages of Meiosis
Quiz
•
9th - 12th Grade
