exam questions

Exam 70-483 All Questions

View all questions & answers for the 70-483 exam

Exam 70-483 topic 1 question 20 discussion

Actual exam question from Microsoft's 70-483
Question #: 20
Topic #: 1
[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 TaskCompletionSource<T> object and call the TrySetException() method of the object.
  • B. Create a task by calling the Task.ContinueWith() method.
  • C. Examine the Task.Status property immediately after the call to the Task.Run() method.
  • D. Create a task inside the existing Task.Run() method by using the AttachedToParent option.
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

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
StudiousMCSD
Highly Voted 5 years, 8 months ago
The answer is incomplete, ContinueWith() requires the parameter TaskContinuationOptions.OnlyOnFaulted to run only on failure.
upvoted 26 times
...
mohmou
Highly Voted 4 years, 11 months ago
Task t = Task.Run(() => LongRunningOperation(1000)); t.ContinueWith((t1) => Console.WriteLine("err"),TaskContinuationOptions.OnlyOnFaulted);
upvoted 6 times
...
Idoudist
Most Recent 5 years, 3 months ago
for more info on taskContinuation : https://docs.microsoft.com/en-us/dotnet/standard/parallel-programming/chaining-tasks-by-using-continuation-tasks
upvoted 2 times
...
TonyBezerra
5 years, 4 months ago
The answer is incomplete, as StudiousMCSD said.
upvoted 6 times
mameenkhn
4 years, 7 months ago
Thank you for telling us
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 ...