exam questions

Exam 70-483 All Questions

View all questions & answers for the 70-483 exam

Exam 70-483 topic 3 question 2 discussion

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

You use the Task.Run() method to launch a long-running data processing operation. The data processing operation often fails in times of heavy network congestion.
If the data processing operation fails, a second operation must clean up any results of the first operation.
You need to ensure that the second operation is invoked only if the data processing operation throws an unhandled exception.
What should you do?

  • A. Create a task within the operation, and set the Task.StartOnError property to true.
  • B. Create a TaskFactory object and call the ContinueWhenAll() method of the object.
  • C. Create a task by calling the Task.ContinueWith() method.
  • D. Use the TaskScheduler class to create a task and call the TryExecuteTask() method on the class.
  • E. Create a TaskCompletionSource<T> object and call the TrySetException() method of the object.
  • F. Examine the Task.Status property immediately after the call to the Task.Run() method.
  • G. Create a task inside the existing Task.Run() method by using the AttachedToParent option.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️
Task.ContinueWith - Creates a continuation that executes asynchronously when the target Task completes. The returned Task will not be scheduled for execution until the current task has completed, whether it completes due to running to completion successfully, faulting due to an unhandled exception, or exiting out early due to being canceled.
References:
http://msdn.microsoft.com/en-us/library/dd270696.aspx

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
Dmn28
4 years, 8 months ago
ContinueWith() method examines the Task.Status under hood. So correct should be F.
upvoted 2 times
...
soats
4 years, 9 months ago
These questions which doesn't have image are probably plain brain dump meaning someone probably forgotten whole signature. C would be correct with the TaskContinuationOptions. F is correct regardless.
upvoted 2 times
killerDJO
4 years, 7 months ago
F can't be correct since Task.Status is examined right after the call to the Task.Run
upvoted 1 times
...
...
josuke
5 years ago
C would run regardless of whether the task exited with an error. F is the only viable option for the given requirements
upvoted 1 times
josuke
4 years, 11 months ago
Although to be fair, C would be correct if TaskContinuationOptions.OnlyOnFaulted was specified in the call to ContinueWith()
upvoted 8 times
BurgSharp
4 years, 10 months ago
That is why C is correct!
upvoted 5 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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago