DRAG DROP
You are developing an application that implements a set of custom exception types. You declare the custom
exception types by using the following code segments:
The application includes a function named DoWork that throws .NET Framework exceptions and custom
exceptions. The application contains only the following logging methods:
The application must meet the following requirements:When ContosoValidationException exceptions are caught, log the information by using the static void Log
(ContosoValidationException ex) method.
When ContosoDbException or other ContosoException exceptions are caught, log the information by using
the static void Log(ContosoException ex) method.
You need to meet the requirements.
You have the following code:
Which code segments should you include in Target 1, Target 2 and Target 3 to complete the code? (To
answer, drag the appropriate code segments to the correct targets in the answer area. Each code segment
may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to
view content.)
Select and Place:
Explanation:
Catch the most specific exception first.
ContosoValidationException
ContosoException
Exception
http://www.aiotestking.com/microsoft/how-should-you-complete-the-relevant-code-200/
aggree with you
agreee
agree
Actually I think that the answer is good. It should be
ContosoValidationException
ContosoDbException
ContosoException
.. because “When ContosoDbException or other ContosoException exceptions are caught, log the information …”
There is no info about default Exception class !!! so if it’s thrown, it should not be logged
The application does not contain any method with dbexception parameter
The class ContosoDbException derives from ContosoException. So a call to Log(ContosoException) with the parameter type ContosoDbException will work without error.
MT’s anwer is correct.
“When ‘ContosoValidationException’ exceptions are caught” , “When ‘ContosoDbException’ or other ‘ContosoException’ exceptions are caught”
so the three ContosoValidationException and ContosoDbException and ContosoException must be included in the three catchs