IT 116: Introduction to Scripting
Quiz 4 Answers

  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. What do you call a loop that does not stop?
    an infinite loop
  3. If you want to stop a Python script running on Unix, what do you do?
    Control C
  4. Will a while loop with the following header ever stop?
    while True:
    no
  5. If range is run with the single argument 5, what is the list of numbers that would be created?
    0, 1, 2, 3, 4
  6. If range is run with the two arguments 1 and 5, what is the list of numbers that would be created?
    1, 2, 3, 4
  7. If range is run with the three arguments 1, 10 and 2, what is the list of numbers that would be created?
    1, 3, 5, 7, 9
  8. If range is run with only one argument, what does that argument specify?
    one more than the last number in the list
  9. If range is run with two arguments, what does the first of the two arguments specify?
    the first number in the list
  10. If range is run with three arguments, what does the third of the three arguments specify?
    the difference between each number in the list