conditional statement assessment

Oct 6, 2014 • Greg Caporaso

Here are a couple of assessments that I put together for conditional statements. This is related to my concept map on this topic.

  1. What is printed by the following block of python code?


x = 300
if x >= 42:
  print “x”,
elif x >= 25:
  print “y”,
else:
  print “z”

(a) x
(b) x y
(c) y
(d) z
(e) x y z
(f) none of the above

  1. Fill in each blank with exactly one of the following phrases: can have, must have, or can’t have.

2.1 An if _____ a condition.
2.2 An if _
____ an elif.
2.3 An if _____ an else.
2.4 An else _
____ a condition.
2.5 An else _____ an execution block.