PrepAway - Latest Free Exam Questions & Answers

What should you do?

You create Microsoft Windows-based applications. You create a component that calls an existing function. The design for the function specifies that it might throw an application-specific exception named InvalidChecksumException, which inherits from System.ApplicationException. The InvalidChecksumException exception is an error that can be handled. But the component cannot handle any other type of error. The component does not have any additional information that can be added to other types of errors. You need to design the component to correctly handle exceptions. You also need to ensure that the exception-handling strategy does not affect performance.
What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Use a catch statement that has a filter for ApplicationExceptions and find the exception type. If it is InvalidChecksumException, handle it automatically or rethrow the exception.

B.
Use only a catch statement that has a filter for InvalidChecksumExceptions and handle them automatically.

C.
Use a catch statement that has an empty filter. Verify the Message property to see if the exception is an InvalidChecksumException and perform the automatic recovery or rethrow the exception.

D.
Use a catch statement that has a filter for InvalidChecksumException, followed by another catch statement that has a filter for Exception. In the first catch block, automatically handle the exception. In the second catch block, log the error and rethrow the exception.


Leave a Reply