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

  1. What do you call a variable that is defined inside a function?
    a local variable
  2. If the variable is defined inside a function, can another function use that variable?
    no
  3. If the variable is defined inside a function, can the code outside all functions use that variable?
    no
  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. What do you call the variables that are listed inside the parentheses of a function header?
    parameters
  7. Where do parameters get their values?
    from the corresponding argument in the function call
  8. Write the function header for a function named calculate_interest that has two variables named principle and interest inside the parentheses, where the default value for interest is 5.
    def calculate_interest(principle, interest=5)
  9. What do you call the expressions (values), inside a function call?
    arguments
  10. Write the function cheer that has a single variable called team in its function header and prints a cheer for that team.
    def cheer(team):
    	print("Go " + team + "!")