You need to ensure that the debugger breaks execution w…

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?

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);

Explanation:
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. http://
msdn.microsoft.com/en-us/library/kssw4w7z.aspx



Leave a Reply 3

Your email address will not be published. Required fields are marked *


Chriss

Chriss

B. Because the question states debugger. The environment is only debug

vitor

vitor

says in all builds of the application, so it’s A

John

John

It does say all builds, but there is no debugger in release mode.