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

  1. 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
  2. If the value of the variable num is 0 before entering the loop above, how many times does the indented statement run?
    10
  3. 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
  4. What happens in a while loop when the boolean expression after the keyword while becomes false?
    the loop stops
  5. What is unusual about the following code?
    num = 5
    while num > 0:
        print(num)
    it will never stop
  6. What do you call a loop that does not stop?
    an infinite loop
  7. If you want to stop a Python script running on Unix, what do you do?
    Control C
  8. Will a while loop with the following header ever stop?
    while True:
    no
  9. What do you call the process of checking that a value entered by a user is correct?
    data validation
  10. What do you call a statement that contains other statements?
    a compound statement