exam questions

Exam 70-483 All Questions

View all questions & answers for the 70-483 exam

Exam 70-483 topic 2 question 60 discussion

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

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 be 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
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

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
CNTPD1
5 years, 1 month ago
I got very confused with this, So tried to create a fiddle. IMO A should be correct answer, correct me if I'm wrong. With async GetData should return string, not Task<string>; https://dotnetfiddle.net/pE7Syo
upvoted 2 times
nickname0815
5 years ago
If the async keyword misses, GetData() will return a Task<string>. But this isn't what we want, because "result" in StartTask() is a string (not a Task). So the answer must be C
upvoted 4 times
...
lomanov
4 years, 11 months ago
"You need to retrieve the result of an asynchronous task that retrieves data from a web service." - GetData must be async.
upvoted 2 times
...
...
VladWork
5 years, 3 months ago
Why A is incorrect?
upvoted 1 times
abelbm
5 years, 3 months ago
Missing 'async' in Getdata()
upvoted 7 times
Alchemia
5 years, 1 month ago
As one could just return a task instead of awaiting it within the GetData() method generating much less compiler generated code, and that the webclient exposes GetStringAsync(string url) I would say the question is too vague. I'm assuming that exception handling is done within the GetData() which would indeed require to mark the method as async and await the GetStringAsync within GetData itself. That would indeed mean that A is incorrect.
upvoted 4 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 ...