Which code should you use?

You need to write a console application that meets the following requirements:
If the application is compiled in Debug mode, the console output must display Entering debug mode.
If the application is compiled in Release mode, the console output must display Entering release mode.
Which code should you use?


A. Option A
B. Option B
C. Option C
D. Option D

microsoft-exams

5 thoughts on “Which code should you use?

  1. #if DEBUG
    Console.WriteLine(“Entering debug mode”);
    #else
    Console.WriteLine(“Entering release mode”);
    #endif

      1. There is no RELEASE defined by default (only DEBUG and TRACE available).
        It’s possible that RELEASE is defined somewhere in the code but this might not meet the second requirement.
        So correct answer should be:
        #if DEBUG
        Console.WriteLine(“Entering debug mode”);
        #else
        Console.WriteLine(“Entering release mode”);
        #endif

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.