ifs Quiz

Last updated over 1 year ago
13 questions
1

What is the output?

bob = 805
if bob > 800:
bob = 0
else:
bob = bob + 25
print(bob)

1

what is the output?

ann = 250
if ann > 100:
ann = ann – 25
elif ann < 100:
ann = ann + 25
print(ann)

1

What is the output?

fred = 700
if fred < 200 or fred > 600:
print("APLUS")
else:
print("COMP SCI!")

1

What is the output?

volume = 45
if volume > 75:
print("Too loud!")
elif volume < 40:
print("Too quiet!")
print("Playing music")

1

What is the output?
page = 178
if page < 50:
print("Beginning of ")
elif page < 200:
if page < 100:
print("First half of")
else:
print("Second half of")
else:
print("End of ")
print("book")

6

Relational operators

Draggable itemCorresponding Item
<=
Determines if two values are equal
>
Determines if two values are not equal
!=
Determines if a value is greater than another
<
Determines if a value is less than another
>=
Determines if a value is greater than or equal to another
==
Determines if a value is less than or equal to another
3

Logical operators

Draggable itemCorresponding Item
x or y
Either x or y must be true
x and y
Both x and y must be true
not x
If x is true, it becomes false
If x is false, it becomes true
1

What would be the output?

8 > 10 or 1< 2

1

What would be the output?

8 > 10 and 1< 2

1

What would be the output?

(12.5 > 10 or 8 > 10) or 1< 2

1

What would be the output?

(12.5 > 10 and 8 > 10) or 1< 2

1

What would be the output?

8 > 10 and (1< 2 and 4 > 2)

1

What would be the output?

8+3 > 10 and (1< 2 and (10/5 + 2 > 2))