IT 116: Introduction to Scripting
Quiz Answers

  1. What do you call a variable that is defined OUTSIDE any function?
    a global variable
  2. Can a function use a variable defined outside any function?
    yes
  3. Are the series of numbers created by the functions in the random module really random?
    no. they are a pseudorandom number sequence
  4. If you wanted to use the functions in the random module inside your script, what statement should appear at the top of the script?
    import random
  5. What do you call the initial value given to an algorithm used to generate "random" numbers.
    seed
  6. What appears after return in a return statement?
    an expression
  7. Name the four types of expressions.
    literals, variables, calculations, function calls
  8. Can a return statement return more than one value?
    yes
  9. Write the SINGLE Python statement you would use to return True if the parameter number_1 were equal to the parameter number_2, but otherwise return False.
    return  number_1 == number_2
  10. Write a SINGLE Python statement to return True if the parameter number were less than 0, but otherwise return False.
    return  number < 0