PrepAway - Latest Free Exam Questions & Answers

What should you do?

You create Web-based client applications. You create a public function for your application that must connect to a data source. The public function must also perform a series of updates to the data. Some of the operations will result in exceptions if there are errors.

Your exception handling mechanism must meet the following requirements:

Callers of the function must be able to ascertain whether the function succeeded or failed. If the function failed, callers of the function must be able to find where and why it failed. If there is any error, the function must immediately stop processing.

You need to identify the best exception handling mechanism. What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Return an application-specific error code indicating overall success or failure of the function, with sub-codes indicating the stage where failure occurred.

B.
Permit any exceptions that are thrown by called functions to propagate the call stack and throw an application-specific exception detailing the cause of failure if a local operation fails. Do not return a status code or throw an exception if the function succeeds.

C.
Permit any exceptions that are thrown by called functions to propagate the call stack and throw an application-specific exception detailing the cause of failure if a local operation fails. Return a status code detailing whether the function succeeds or does not succeed.

D.
Return an application-specific exception that includes any caught exceptions or return null if the entire function succeeds.


Leave a Reply