exam questions

Exam 70-483 All Questions

View all questions & answers for the 70-483 exam

Exam 70-483 topic 1 question 34 discussion

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

You are debugging an application that calculates loan interest. The application includes the following code. (Line numbers are included for reference only.)

You need to ensure that the debugger breaks execution within the CalculateInterest() method when the loanAmount variable is less than or equal to zero in all builds of the application.
What should you do?

  • A. Insert the following code segment at line 03:Trace.Assert(loanAmount > 0);
  • B. Insert the following code segment at line 03:Debug.Assert(loanAmount > 0);
  • C. Insert the following code segment at line 05:Debug.Write(loanAmount > 0);
  • D. Insert the following code segment at line 05:Trace.Write(loanAmount > 0);
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️
By default, the Debug.Assert method works only in debug builds. Use the Trace.Assert method if you want to do assertions in release builds. For more information, see Assertions in Managed Code.
References: http://msdn.microsoft.com/en-us/library/kssw4w7z.aspx

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
ArunPrem
Highly Voted 5 years, 5 months ago
Option A is correct since the question is about all builds of the application. Debug.Assert will work only in the debug mode but Trace.assert will work in all the builds..
upvoted 20 times
...
swagrid1556
Most Recent 4 years, 5 months ago
It would be A since it assumes you would assume that you are debugging an already released application, and since it is a release build it would be trace since debug would be used for a application that is still in the development phase. its a tad tricky just look for keywords and be very careful and you should be 100s
upvoted 2 times
...
makiiiiiii
4 years, 8 months ago
I think it's A, because it says "in all builds of the application."
upvoted 2 times
...
Dmn28
4 years, 9 months ago
It says that 'You are debugging an application'. So, 'B' is correct
upvoted 1 times
...
memou
4 years, 12 months ago
Tracer`s default output place is the same place as debugger.ArunPrem is right.
upvoted 1 times
...
abelbm
5 years ago
https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.trace.assert?view=netframework-4.8
upvoted 1 times
...
xman
5 years, 3 months ago
i think the answer is B as well
upvoted 1 times
...
Borjaromero
5 years, 6 months ago
I think that the correct is B, because the questions said in debugger
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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago