IT 116: Introduction to Scripting
Answers to Class 8 Ungraded Quiz

  1. Write a Python statement that evaluates to True if the variable whose name is num has a value greater than 0 and less than 10.
    num > 0  and num < 10
  2. Write a Python statement that evaluates to True if the variable whose name is num has a value greater than or equal to 0 and less than or equal to 10.
    num >= 0  and num <= 10
  3. What is the data type of the variable whose name is value_good that is created by the following statement?
    value_good = num > 0
    boolean
  4. In the loop below, what happens each time the boolean expression after the keyword while evaluates to true?
    while num < 10:
    	num = num + 1
    the value of num increases by 1
  5. If the value of the variable num is 0 before entering the loop above, how many times does the indented statement run?
    10
  6. If the value of the variable num is 0 before entering the loop above, what is the value of the variable num after the loop stops running?
    10
  7. When does a while loop stop?
    when the  boolean expression after the keyword while becomes false
  8. If you typed the following in the Python interactive mode, what would the result be?
    True and False
    False
  9. If you typed the following in the Python interactive mode, what would the result be?
    True or False
    True
  10. If you typed the following in the Python interactive mode, what would the result be?
    not True
    False