Advertisements
Advertisements
Question
While executing the program, if an exception is encountered in try block then execution of the code inside the try block is stopped and:
Options
Code of except block is executed and control is moved to the beginning of try block.
Control goes to except block and program stops.
Control goes to except block and lines after try ... except are executed.
Except bock is ignored.
MCQ
Solution
Control goes to except block and lines after try ... except are executed.
Explanation:
If an exception occurs while running the programme, execution of the code within the try block is halted, and control is passed to the except block, where the lines after try... except are executed.
shaalaa.com
Handling Exceptions
Is there an error in this question or solution?