Conditionals Unit Quiz

Quiz
•
Computers
•
9th Grade - University
•
Medium

Nathan Denton
Used 154+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What does this program print?
favorite_color = "blue"
if favorite_color != "blue":
if favorite_color != "red":
print("Must be yellow")
elif favorite_color == "blue":
if favorite_color != "yellow":
print("Must be blue")
elif favorite_color == "blue":
if favorite_color != "yellow":
print("I like purple")
else:
if favorite_color == "blue":
print("Blue is the best")
Must be yellow
Must be blue
I like purple
Blue is the best
Must be blue
Blue is the best
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
How would you round the number held in the variable pi to 3.14?
pi = 3.14159265
round(pi)
round(pi, 3)
round(3, pi)
round(pi, 2)
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Why should you use round when you compare two numbers that have type float?
If you don’t, Python will only compare the whole part and discard the decimal part.
You don’t have to, but it’s good style. All of the comparisons will still work out the same way.
Sometimes numbers can be rounded in unexpected ways based on how Python computes them. Therefore, it is best to use round in order to make sure both numbers are rounded the same way.
You should always use round when you compare two numbers, even if they are of type int.
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What will print to the screen when the following program is run?
number = 5
greater_than_zero = number > 0
print(type(number))
5
True
<type ‘int’>
<type ‘bool’>
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What will print to the screen when the following program is run?
number = 5
less_than_zero = number < 0
print(type(less_than_zero))
5
False
<type ‘int’>
<type ‘bool’>
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What will be the output of this program?
number = 5
greater_than_zero = number > 0
if greater_than_zero:
print(number)
o
5
True
Nothing will print
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What will be the output of this program?
number = 5
greater_than_zero = number > 0
if greater_than_zero:
if number > 5:
print(number)
0
5
True
Nothing will print
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
Python Basics 2

Quiz
•
9th - 12th Grade
20 questions
PEMROGRAMAN DASAR PYTHON

Quiz
•
11th Grade
10 questions
KS4 Programming Techniques (1)

Quiz
•
8th - 10th Grade
15 questions
CodeHS Python Conditionals Quiz Reveiw

Quiz
•
9th - 12th Grade
15 questions
JavaScript Knowledge & Skills

Quiz
•
9th - 12th Grade
15 questions
Y7 Python Mid Point

Quiz
•
7th - 12th Grade
10 questions
Functions and Parameters Summative preview

Quiz
•
9th - 12th Grade
10 questions
Python Boolean and If

Quiz
•
9th - 12th Grade
Popular Resources on Wayground
18 questions
Writing Launch Day 1

Lesson
•
3rd Grade
11 questions
Hallway & Bathroom Expectations

Quiz
•
6th - 8th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
19 questions
Handbook Overview

Lesson
•
9th - 12th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
Discover more resources for Computers
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
19 questions
Handbook Overview

Lesson
•
9th - 12th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
40 questions
LSHS Student Handbook Review: Pages 7-9

Quiz
•
11th Grade
24 questions
Scientific method and variables review

Quiz
•
9th Grade
10 questions
Characteristics of Life

Quiz
•
9th - 10th Grade
19 questions
Mental Health Vocabulary Pre-test

Quiz
•
9th Grade