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

  1. If you wanted to use the functions in the math module inside your script, what statement should appear at the top of the script?
    import math
  2. If you wanted to print the value of pi from the math module, what statement would you use?
    print(math.pi)
  3. Write the a function call that will return the value of the sine of π. The sine function in the math module is sin
    math.sin(math.pi)
  4. What do you call a variable that is defined OUTSIDE any function?
    a global variable
  5. Can a function use a variable defined outside any function?
    yes
  6. Are the series of numbers created by the functions in the random module really random?
    no. they are a pseudorandom number sequence
  7. 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
  8. If you wanted to simulate the throw of a die using the randint function of the random module, what would you use as the function call?
    random.randint(1,7)
  9. Can a return statement return more than one value?
    yes
  10. What do you call the initial value given to an algorithm used to generate "random" numbers.
    seed