You are developing an application that uses multiple asynchronous tasks to optimize performance. The
application will be deployed in a distributed environment.
You need to retrieve the result of an asynchronous task that retrieves data from a web service.
The data will later be parsed by a separate task.
Which code segment should you use?

A.
Option A
B.
Option B
C.
Option C
D.
Option D
A
6
12
Should be B. A is an invalid casting.
18
1
A is correct. You need to put async only when you have await in the body of the method.
7
2
We don’t know does the body of GetData() contain await or not. So the the answer could be A or B and the question is not correct I guess.
5
2
Agree. Depends on how the return statement is formatted in GetData(). If it returns a Task object it’s A, if it returns a string it’s B.
The following are both correct:
public Task GetData() => Task.FromResult(“some data”);
and
public async Task GetData() => “some data”;
3
0
Dude, it already returns Task class, which is already asyncronous and doesnt need async keyword.
You can get the result from Task by using await or getting Task.Result
The correct answer is A.
Please read about tasks and TPL – many developers doesn’t know the correct answer for this simple question.
2
0
B
https://stackoverflow.com/questions/26205173/using-async-keyword-in-method-signature-to-return-a-task-in-web-api-endpoint
1
4
Asynchronous Task they said, You need to retrieve the result of an asynchronous task. so its B
17
4
A
2
6
Wow!!! I can see the first correct answers for this question!!! Comments for previous versions of dumps doesn’t contain correct answers for this question at all!!!
0
0