Which of the following blocks will be executed whether an exception is thrown or not?

Which of the following blocks will be executed whether an exception is thrown or not?
A. except
B. else
C. finally
D. assert
 
Answer: c
Explanation: The statements in the finally block will always be executed, whether an exception is thrown or not. This clause is used to close the resources used in a code.
 

Tìm kiếm

Back
Top