exam questions

Exam 70-487 All Questions

View all questions & answers for the 70-487 exam

Exam 70-487 topic 2 question 7 discussion

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

Errors occasionally occur when saving data using the FlightInfoContext ADO.NET Entity Framework context. Updates to the data are being lost when an error occurs.
You need to ensure that data is still saved when an error occurs by retrying the operation. No more than five retries should be performed.
Which code segment should you use as the body of the SaveChanges() method in the FlightInfoContext.es file?


  • A. Option A
  • B. Option B
  • C. Option C
  • D. Option D
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

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
celaler481yektaracom
4 years, 5 months ago
All are wrong. A. has a try catch that will always complete the for loop, thus SaveChanges 6x. B. reuses the previous exception if !IsTransient, thus it gets stuck in an endless loop. C. gives up after receiving a transient error, which are normally the type you want to retry. It still saves atleast twice. D. has the same issue as A.
upvoted 1 times
...
not2smart
4 years, 9 months ago
The question does not show the source code of FlightInfoContext.cs in which the IsTransient method is implemented (code can be found on other web sites). private bool IsTransient(int ex) { var errors = new[] { 10053, 10054, 64 }; return errors.Contains(ex); } - IsTransient(Exception ex) returns true, if exception number is 10053, 10054 or 64. - Socket error (10053) – An established connection was aborted by the software in your host machine. - Socket error (10054) – The virtual circuit was reset by the remote end. - Error (64) – The specified network name is no longer available. - Error (64) – Host not available. - Answer A is correct, retry 5 times if the exception number is connection failure related 10053, 10054 or 64.
upvoted 3 times
...
Natali
4 years, 11 months ago
A is correct. In older dumps it is the only similar option provided :)
upvoted 2 times
...
supersunny
5 years, 2 months ago
A is correct.
upvoted 2 times
...
tiger25
5 years, 3 months ago
This is the second weird question. Answer A clearly correct. But answer D are correct too. Well, I do know what transient error does mean. But whichever transient or other error occur - answer A and D will not break the loop and make five attemps. So both this answers are correct and have the same logic.
upvoted 2 times
mfg41
5 years, 2 months ago
A and D is really same? With one small difference: ! if(IsTransient(ex.Number)) continue; if(!IsTransient(ex.Number)) continue;
upvoted 2 times
Gorilla
4 years, 12 months ago
The solution I would expect is if (!IsTransient(ex.Number)) break; For me this looks like someone made a mistake, when preparing this question.
upvoted 4 times
...
tiger25
5 years, 2 months ago
yes, but the general logic after this condition is the same. Either there is transient exception or not there is no difference, loop will continue. In my first exam attempt the question was exactly the same. But in the last attempt only the one option: if(IsTransient(ex.Number)) continue;
upvoted 4 times
mr_
4 years, 9 months ago
tiger25 & Gorilla - good point. Both A & D basically will work exactly the same in terms of retry mechanism as I see. Transient error will be handled the same way. And your answer proposal Gorilla makes the most sense actually but there is no such answer. I would go for A even if it is weird that D satisfies the requirements too. By the way - transient errors are the ones that are really likely to be self-fixed by their nature and where retrying mechanism make sense because there is big chance that second and the following attempts will eventually succeed. For example calling external service which is temporarily unavailable but after 2-3 seconds may be back online.
upvoted 1 times
...
...
...
tadas
4 years, 4 months ago
It will break loop. Because of return.
upvoted 2 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