This set of Python Multiple Choice Questions & Answers (MCQs) focuses on
“Exception Handling”.
1. How many except statements can a try-except block have?
a) zero
b) one
c) more than one
d) more than zero
2. When will the else part of try-except-else be executed?
a) always
b) when an exception occurs
c) when no exception occurs
d) when an exception occurs in to except block
3. Can one block of except statements handle multiple exception?
a) yes, like except Type Error, Syntax Error [,…]
b) yes, like except [Type Error, Syntax Error]
c) no
d) none of the mentioned
4. When is the finally block executed?
a) when there is no exception
b) when there is an exception
c) only if some condition that has been specified is satisfied
d) always
5.. Which of the following is not an exception handling keyword in Python?
a) try
b) except
c) accept
d) finally
6. Which of the following statements is true?
a) The standard exceptions are automatically imported into Python programs
b) All raised standard exceptions must be handled in Python
c) When there is a deviation from the rules of a programming language, a
semantic error is thrown
d) If any exception is thrown in try block, else block is executed
7. Which of the following is not a standard exception in Python?
a) Name Error
b) IOError
c) Assignment Error
d) Value Error
8.Syntax errors are also known as parsing errors.
a) True
b) False
9.An exception is ____________
a) an object
b) a special function
c) a standard module
d) a module
10._______________________ exceptions are raised as a result of an error in
opening a particular file.
a) Value Error
b) Type Error
c) Import Error
d) IOError
11. Which of the following blocks will be executed whether an exception is
thrown or not?
a) except
b) else
c) finally
d) assert