1. What is the purpose of exception handling in Python? A. To handle runtime errors and prevent the program from crashing B. To print error messages C. To ignore errors D. To enhance program speed Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
2. 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 Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
3. What is an exception in Python? A. An error that occurs during the execution of a program B. A built-in function C. A keyword D. A specific data type Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
4. How many except statements can a try-except block have? A. zero B. one C. more than one D. more than zero Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
5. What will happen if an exception is raised in a try block and is not handled in any of the except blocks? A. The program will terminate with an error message B. The program will continue running C. The program will go into an infinite loop D. The program will pause Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
6. Which built-in Python function can be used to retrieve the error message associated with an exception? A. str() B. error() C. message() D. exc_info() Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
7. 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 Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
8. Can one block of except statements handle multiple exception? A. yes, like except TypeError, SyntaxError [,...] B. yes, like except [TypeError, SyntaxError] C. no D. none of the mentioned Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
9. Which keyword is used to handle exceptions in Python? A. try B. catch C. handle D. exception Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
10. Which of the following statements is true regarding the order of except clauses? A. The except clauses should be ordered from more specific exceptions to more general ones B. The order does not matter C. The most general exception should come first D. The most specific exception should come first Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board