exam questions

Exam MB-500 All Questions

View all questions & answers for the MB-500 exam

Exam MB-500 topic 4 question 6 discussion

Actual exam question from Microsoft's MB-500
Question #: 6
Topic #: 4
[All MB-500 Questions]

HOTSPOT -
You are a Dynamics 365 Finance developer.
You have the following code: (Line numbers are included for reference only.)

You need to evaluate the code.
What is the correct output for the method? To answer, select the appropriate option in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: One, Two, Four, Fire -
The statements in the finally clause are executed when control leaves the try block, either normally or through an exception.

Box 2: One, Three, Four, Five -

Box 3: One, Three -
Return ends the call.
Box 4: One, Three, One, Two, Four, Five
Retry restarts the try statement.
Reference:
https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-exceptions

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
sadoki9311
Highly Voted 3 years, 1 month ago
trymethod(2,0) will give One Three four trymethod(3,0) will give One Two Four Five >> The retry statement can be written only in a catch block. The retry statement causes control to jump up to the first line of code in the associated try block. The retry statement is used when the cause of the exception can be fixed by the code in the catch block. The retry statement gives the code in the try block another opportunity to succeed. The retry statement erases all messages that have been written to the Infolog since program control entered the try block.
upvoted 44 times
ImranBalti
1 year, 10 months ago
Below ET82 gave correct answer.
upvoted 1 times
...
Ahmed_Hassan
2 years, 11 months ago
Yes retry will erase the info, nice catch indeed
upvoted 5 times
...
Tomas1
2 years, 10 months ago
I tried practically, your answer is correct
upvoted 3 times
...
Sisb
1 year, 10 months ago
I agree. Try method will erase msg once failed Try(2,0) will bring One, three, four Try(3,0) will erase middle stage, from One , two, then jump and directly go to Four Five
upvoted 2 times
...
...
vairamsrinivasan
Highly Voted 2 years, 6 months ago
Verified using VisualStudio 100% correct answer. tryMethod(5, 2) - One, Two, Four, Five tryMethod(4, 0) - One, Three, Four, Five tryMethod(2, 0) - One, Three, Four tryMethod(3, 0) - One, Two, Four, Five
upvoted 12 times
Derian
8 months, 2 weeks ago
I have verified too : you are right!!!
upvoted 2 times
...
...
FBDSTAcc
Most Recent 5 months, 1 week ago
1,1,1,1
upvoted 1 times
...
Prollyx
1 year, 7 months ago
tryMethod(3,0) → One, Two, Four, Five (The retry statement erases all messages that have been written to the Infolog since program control entered the try block.) - this output will be visible in the D365 application - but in the Infolog of Visual Studio will be - One Three One Two Four Five
upvoted 2 times
...
Raj_269
1 year, 8 months ago
tryMethod(3,0) = ONE, TWO, FOUR FIVE is the correct ans..The retry statement will clear all the previous info messages
upvoted 3 times
...
faycal
1 year, 9 months ago
tryMethod(5,2) -> One, Two, Four, Five tryMethod(4,0) -> One, Three, Four, Five tryMethod(2,0) -> One, Three, Four tryMethod(3,0) -> One, Three, One, Two, Four, Five
upvoted 1 times
...
EricVella
2 years, 1 month ago
The answers are correct.
upvoted 1 times
...
ET82
2 years, 3 months ago
Tested with VS debug: tryMethod(5,2) -> One, Two, Four, Five tryMethod(4,0) -> One, Three, Four, Five tryMethod(2,0) -> One, Three, Four tryMethod(3,0) -> One, Three, One, Two, Four, Five
upvoted 8 times
ImranBalti
1 year, 10 months ago
@ET82 exactly you are right.
upvoted 1 times
...
...
boost
2 years, 4 months ago
1, 1, 1, 1
upvoted 5 times
...
Haruki1521
2 years, 6 months ago
tryMethod(4,0) is One,Two, Four and Five. So, the current answer is not correct!
upvoted 1 times
...
Haruki1521
2 years, 6 months ago
tryMethod(4,0) is One,Two, Four and Five. So, the current answer is not correct!
upvoted 1 times
...
Haruki1521
2 years, 6 months ago
tryMethod(4,0) will give One,Two,Four and Five. So, the current answer is not correct.
upvoted 1 times
...
BuzzZ
2 years, 7 months ago
all are the 1st answer
upvoted 1 times
...
phamvanphuong1501
3 years, 1 month ago
tryMethod(2,0) -> One, Three and Four
upvoted 8 times
juozapyne
2 years, 9 months ago
Yes you are correct. Finally is executed even on hard return :-)
upvoted 2 times
...
ODARK
2 years, 7 months ago
I tried this in code, it show only "One, Three". And also the solution is correct.
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