exam questions

Exam AZ-202 All Questions

View all questions & answers for the AZ-202 exam

Exam AZ-202 topic 14 question 1 discussion

Actual exam question from Microsoft's AZ-202
Question #: 1
Topic #: 14
[All AZ-202 Questions]

HOTSPOT -
You need to configure retries in the LoadUserDetails function in the Database class without impacting user experience.
What code, should you insert on line DB07?
To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: Policy -

RetryPolicy retry = Policy -
.Handle<HttpRequestException>()
.Retry(3);
The above example will create a retry policy which will retry up to three times if an action fails with an exception handled by the Policy.
Box 2: WaitAndRetryAsync(3,i => TimeSpan.FromMilliseconds(100* Math.Pow(2,i-1)));
A common retry strategy is exponential backoff: this allows for retries to be made initially quickly, but then at progressively longer intervals, to avoid hitting a subsystem with repeated frequent calls if the subsystem may be struggling.
Example:

Policy -
.Handle<SomeExceptionType>()
.WaitAndRetry(3, retryAttempt =>
TimeSpan.FromSeconds(Math.Pow(2, retryAttempt))
);
References:
https://github.com/App-vNext/Polly/wiki/Retry

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
oxaytol
4 years, 11 months ago
Wrong answer selection, however explanation it is right, go to the explanation and check the correct answer for the second box: WaitAndRetryAsync(3,i => TimeSpan.FromMilliseconds(100* Math.Pow(2,i-1)));
upvoted 1 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 ...