exam questions

Exam 70-483 All Questions

View all questions & answers for the 70-483 exam

Exam 70-483 topic 2 question 126 discussion

Actual exam question from Microsoft's 70-483
Question #: 126
Topic #: 2
[All 70-483 Questions]

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:

Show Suggested Answer Hide Answer
Suggested Answer:
Catch the most specific exception first.

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Asa
Highly Voted 6 years ago
Correct answer is: 123
upvoted 23 times
...
Littlesneak
Highly Voted 5 years, 4 months ago
1,2,3 if the names were correct..
upvoted 6 times
...
Igris
Most Recent 5 years, 6 months ago
i would say 1 4 3. by or other we can only imply that we catch all exceptions so Exception
upvoted 2 times
whtvr
5 years, 4 months ago
✑ When ContosoDbException or other ContosoException exceptions are caught, log the information by using the static void Log(ContosoException ex) method. So you need to catch the ContosoException, and at the end just go for normal Exception. That means - 1,2,3
upvoted 5 times
CNTPD1
5 years, 1 month ago
but the question states "...or other ContosoException exceptions are caught." So why do we need to go for normal exceptions? I agree it makes not sense, But I think answer should contain all but base Exception. In any case question is confusing.
upvoted 1 times
Sterlinho
4 years, 12 months ago
@CNTPD we need to catch base exceptions because we are told that: "The application includes a function named DoWork that throws .NET Framework exceptions and custom exceptions."
upvoted 1 times
...
Kilsimon
4 years, 9 months ago
If we catch the ContosodbExpection before the ContosoException it will log it ContosodbException using the Log(ContosodbException), which we do not want. If we catch the ContosodbException after the ContosoException, it will never be used as ContosoException will catch them all. It therefore makes sense to use the Expection as target 3.
upvoted 2 times
...
...
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...