Python booleans & if/elif/else

Python booleans & if/elif/else

Assessment

Flashcard

Computers

9th - 12th Grade

Practice Problem

Hard

Created by

Wayground Content

FREE Resource

Student preview

quiz-placeholder

10 questions

Show all answers

1.

FLASHCARD QUESTION

Front

The result of this program:
Friday = False
if Friday:
...print "Jeans day!"
else:
...print "Dress code"
Options: Jeans day, Dress code, Nothing prints, Error

Back

Dress code

2.

FLASHCARD QUESTION

Front

What is the result of the code:
team = "Cowboys"
if team = "Cowboys":
...print "Dallas is #1"

Back

Error

3.

FLASHCARD QUESTION

Front

What is the output of the following code:
income = 4001
if income > 3000:
...print("Income is greater than 3000")
elif income > 4000:
...print("Income is greater than 4000")

Back

Income is greater than 3000

4.

FLASHCARD QUESTION

Front

Suppose you write the code to display "Cannot get a driver's license" if age is less than 16 and "Can get a driver's license" if age is greater than or equal to 16. Which of the following code is the best? Options: if age < 16: ...print("Cannot get a driver's license") if age >= 16: ...print("Can get a driver's license"), if age < 16: ...print("Cannot get a driver's license") else: ...print("Can get a driver's license"), if age < 16: ...print("Cannot get a driver's license") elif age >= 16: ...print("Can get a driver's license"), if age < 16: ...print("Cannot get a driver's license") elif age > 16: ...print("Can get a driver's license") elif age == 16: ...print("Can get a driver's license")

Back

if age < 16:
...print("Cannot get a driver's license")
else:
...print("Can get a driver's license")

5.

FLASHCARD QUESTION

Front

Assume x = 4 and y = 5. Which of the following is true?
Options: x < 5 and y < 5, x < 5 or y < 5, x > 5 and y > 5, x > 5 or y > 5

Back

x < 5 or y < 5

6.

FLASHCARD QUESTION

Front

What is the output of the following code?
ch = "F"
if ch == "f" and ch == "F"
...print(ch)

Back

nothing

7.

FLASHCARD QUESTION

Front

What is the output of the following code?
ch = "F"
if ch == "f" or ch == "F":
...print(ch)

Back

F

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?