Select the true statements about the try-except block in relation to the following example. (Select two answers.)
try: # Some code is here... except: # Some code is here...
- If you suspect that a snippet may raise an exception, you should place it in the try block.
- The code that follows the try statement will be executed if the code in the except clause runs into an error.
- The code that follows the except statement will be executed if the code in the try clause runs into an error.
- If there is a syntax error in code located in the try block, the except branch will not handle it, and a SyntaxError exception will be raised instead.
Explanation: If the code placed inside a try block raises an exception, the following code lines within the block will not be executed, and the exceptions defined below will try to handle the error generated.
More Questions: Python Essentials 1 – Module 4 Test
Please login or Register to submit your answer