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

  1. What is a syntax error?
    an error caused by code that does not follow the rules of the Python language
  2. What is a logic error?
    an error that causes the code to give incorrect results
  3. What is a runtime error?
    when a Python statement directs the interpreter to do something it cannot do
  4. What does the Python interpreter do when it comes upon a runtime error?
    creates an exception object 
  5. When does the Python interpreter create an exception object?
    when a runtime error occurs
  6. What type of statement can be used to deal with an exception?
    a try/except statement
  7. What should you put in the first block of the above statement?
    any code that might cause a runtime error
  8. What code should you put in the second block of this statement?
    code that deals with the exception
  9. What happens when an exception is encountered in the try block of such a statement?
    the interpreter stops running the code in the 1st block and jumps to the code in the 2nd block