exam questions

Exam 70-483 All Questions

View all questions & answers for the 70-483 exam

Exam 70-483 topic 2 question 135 discussion

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

HOTSPOT -
You are building an application in Microsoft Visual Studio 2013.
You have the following code.

For each of the following statements, select Yes if the statement is true. Otherwise, select No.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:

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
peter1994
Highly Voted 5 years, 3 months ago
All yes.
upvoted 25 times
bleasdal3
4 years, 10 months ago
in release mode the block is not compiled because it doesnt satisfy the conditional. Therefore the call to Trace.Write never happens even if it wasn't enclosed in #if(Debug)
upvoted 4 times
sscooter1010
4 years, 10 months ago
The very first line of the program is #define DEBUG Therefore DEBUG will always be defined. I confirmed this by test.
upvoted 17 times
...
...
...
ciprian_alexandru
Highly Voted 5 years, 9 months ago
First answer is wrong ("When RunTestClass executes, LogData1 will be written if the application starts in Debug mode"). Right answer is "Yes".
upvoted 25 times
JF_Me
4 years, 5 months ago
I tested it and if we add the #define DEBUG directive it will compile DEBUG code even in release mode.
upvoted 3 times
...
...
demoinq
Most Recent 4 years ago
Tested with the following code: #define DEBUG using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DebugTest { class Program { [Conditional("DEBUG")] static void LogLine() { Console.WriteLine("LogLine1"); } static void Main(string[] args) { LogLine(); #if DEBUG Console.WriteLine("LogLine2"); #endif Console.ReadLine(); } } } All should be "Yes". The #define DEBUG in the first line is confusing and causing the app to always run with this symbol defined.
upvoted 3 times
...
Bintang0
4 years, 1 month ago
All yes. #DEBUG is defined no all conditions are true. It doesn't matter in which mode you start the application. The #DEBUG word could be replaced by #SomeThingElse.
upvoted 1 times
...
HgstExam
4 years, 3 months ago
Tricky Question: But the anwser is YES,YES,YES confirmed. when no #define is used under Release mode then nothing would be traced, but now all are traced even when no Debug mode is on.
upvoted 2 times
...
thiemamd
4 years, 4 months ago
Yes Yes No https://stackoverflow.com/questions/3788605/if-debug-vs-conditionaldebug
upvoted 1 times
thiemamd
4 years, 4 months ago
Oh am little confused. I think YES YES YES since 'DEBUG' will always be true. But I am wondering now how execute only in debug mode?
upvoted 1 times
thiemamd
4 years, 4 months ago
I just found the answer: Yes Yes Non The code in the condition block won't be include in the assembly file output Source: Go check in this book(Rob Miles - Exam Ref 70-483 Programming in C#-Microsoft Press (2018)) at page 231
upvoted 1 times
...
...
...
Sully_2020
4 years, 8 months ago
Answer should be Yes, Yes, No. If the application is running in RELEASE mode the call to this.LogData() would throw an exception prior to writing out LogData2 because the LogData() method would not be compiled in the RELEASE build, that is if it would even allow you to build in RELEASE mode due to that fact.
upvoted 1 times
Sully_2020
4 years, 8 months ago
Sorry, scratch that. Answer should be Yes, Yes, Yes. I forgot about the fact that when using a Conditional attribute, the method and any calls to that method are not compiled. "Applying ConditionalAttribute to a method indicates to compilers that a call to the method should not be compiled into Microsoft intermediate language (MSIL) unless the conditional compilation symbol that is associated with ConditionalAttribute is defined." ( https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.conditionalattribute?view=netframework-4.8 )
upvoted 6 times
...
...
sscooter1010
4 years, 10 months ago
All yes, confirmed by test. The first line is #define DEBUG which means it is always defined in this file.
upvoted 20 times
rhysabray
4 years, 9 months ago
I agree and have also tested it. - [Conditional("DEBUG")] checks if application is running in debug mode. So, if running in debug then "LogData1" is displayed. - #if (DEBUG) checks if DEBUG has been previously defined, and it doesn't have to be in debug mode for it to be defined. So, regardless of mode, "LogData2" is always displayed. The use of the word DEBUG is what is throwing people. To those unsure try it yourself using any word. For example; #define THISCANLITERALLYBEANYTHING #if (THISCANLITERALLYBEANYTHING) // do code stuff #endif and run in both debug and release modes.
upvoted 5 times
...
...
founderDev
4 years, 10 months ago
correct answer is Yes,Yes,No
upvoted 8 times
Bintang0
4 years, 1 month ago
wrong, its y y y
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