WorksheetsPython Conditionals Review
Total questions: 31
Worksheet time: 17mins
What is the output?
condition
True
Program has a syntax error.
3 > 2
What is the output?
True
False
condition1
condition2
What is the output?
more than 7
more than 23
more than 23
True
more than 7
True
True
What is the output?
250.0
200.0
300.0
350.0
What is the output?
next
stop
next
stop
syntax error - program doesn't work
What is the output?
3
3
7
3
5
7
7
What is the output?
True
NIL
True
NIL
True
NIL
NIL
What is the output?
level 3
level 3
level 1
level 3
level 1
NIL
level 3
level 2
level 1
NIL
What is the output?
40
15.0
30
25.0
What will print to the screen when the following program is run?
5
True
<class ‘int’>
<class ‘bool’>
What will be the output of this program?
0
5
True
Nothing will print
What is the result of this code?
Issue Driver's License
Almost eligible for Driver's License
No requirements met.
none of these
Get a job!
Data type that can only be true or false
int
string
boolean
float
Which one of the following shows correct syntax ?
if answer == "Yes"
if answer == "Yes":
if answer = "Yes":
If you want to test more than one condition (chained condition), what do you use after if statement?
elif
else
ifif
else if
Which character must be at the end of an IF statement?
:
;
.
{
What is the output?
nothing will be printed
HelloBob
Hello Bob
I don't know you
Hello Bob
What will be the output of the following code?
11.50
12
11.6
11.5
Error. Invalid syntax
How many stars will be printed?
Error, char is not defined.
11
12
0
What will the output be?
2
11
0
Nothing. syntax error
Choose the 3 steps in the anatomy of the accumulator pattern.
initializing the accumulator variable
updating the accumulator variable
testing the accumulator variable
iterating over the items in a sequence
Select all the strings that are less than "December"
"december"
"Decagon"
"D Nice"
"123December"
dogs = [12, 10, 12, 8, 7, 6, 9, 10, 12, 11] contains the ages of the dogs at doggie daycare. Which code correctly finds the age of the youngest dog?
x: 5 < 10
y: 6 > 7
What is the truth value for: x and y
True
False
x: 5 < 10
y: 6 > 7
What is the truth value for: (not x) or y
True
False
If you want to solve "x and (x or not y)" using a truth table, you would need columns for x, y and the statement you want to solve. What other columns would you need?
not x
not y
x and y
x or not y
If you have a list of grades and you want to iterate over the list to find out which grade is the highest. How should you initialize your accumulator variable?
highest_grade = 0
highest_grade = 1
highest_grade = grades[-1]
highest_grade = grades[0]
Which of these statements will make sure (.0045 / 100) and (.0045) will compare to be equal in an if statement?
if round (0.0045 / 100, 5) == round(0.000045, 5):
if round (0.0045 / 100, 5) = round(0.0045, 5):
if (0.0045 / 100, round) == (0.0045, round):
if (0.0045 / 100).round() == 0.0045.round():
If x contains the number 0.00456, how would I round x to 4 decimal places?
x.round(4)
round(x, 4)
round.x(4)
round(4, x)
