nerdexam
Microsoft

98-361 · Question #46

The purpose of the Finally section in an exception handler is to:

The correct answer is A. Execute code regardless of whether an exception is thrown.. By using a finally block, you can clean up any resources that are allocated in a try block, and you can run code even if an exception occurs in the try block. Typically, the statements of a finally block run when control leaves a try statement. The transfer of control can occur a

Understanding Core Programming

Question

The purpose of the Finally section in an exception handler is to:

Options

  • AExecute code regardless of whether an exception is thrown.
  • BConclude the execution of the application.
  • CExecute code only when an exception is thrown.
  • DBreak out of the error handler.

How the community answered

(26 responses)
  • A
    77% (20)
  • B
    4% (1)
  • C
    4% (1)
  • D
    15% (4)

Explanation

By using a finally block, you can clean up any resources that are allocated in a try block, and you can run code even if an exception occurs in the try block. Typically, the statements of a finally block run when control leaves a try statement. The transfer of control can occur as a result of normal execution, of execution of a break, continue, goto, or return statement, or of propagation of an exception out of the try statement.

Topics

#exception handling#finally block#try-catch-finally

Community Discussion

No community discussion yet for this question.

Full 98-361 Practice