adplus-dvertising
frame-decoration

Question

What will be the output of following code snippet?
#define DEBUG 
#define MYTEST
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace ConsoleApplication13
{
    class Program
    {   
        static void Main(string[] args)
        {
            #if (DEBUG && !MYTEST)
            Console.WriteLine("DEBUG is defined");
            #elif (!DEBUG && MYTEST)
            Console.WriteLine("MYTEST is defined");
            #elif (DEBUG && MYTEST)
            Console.WriteLine("DEBUG and MYTEST are defined");
            #else
            Console.WriteLine("DEBUG and MYTEST are not defined");
            #endif
            Console.ReadLine();
        }
    }
}

a.

DEBUG is defined
MYTEST is defined

b.

MYTEST is defined
DEBUG and MYTEST are defined

c.

DEBUG and MYTEST are not defined
MYTEST is defined

d.

DEBUG and MYTEST are defined

Answer: (d).DEBUG and MYTEST are defined

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be the output of following code snippet?

Similar Questions

Discover Related MCQs

Q. What does preprocessor directive #if and #endif explains?

Q. Select the defined preprocessor in C#.NET?

Q. What is meant by preprocessor directive #define?

Q. What is meant by preprocessor directive in C#.NET?

Q. Choose the symbol which begins a preprocessor directive in C#.NET?

Q. Which among the following is the correct statement about the using statement used in C#.NET?

Q. If ListBox is the class of System.Windows.Forms namespace.Then,correct way to create an object of ListBox class is?

Q. Which among the following is a .NET namespace?

Q. Which among the following statements are not correct about a namespace used in C#.NET?

Q. Which among the following is a correct statement about namespace used in C#.NET?

Q. Which among the following does not belong to the C#.NET namespace?

Q. Which is the correct statement about the namespaces in C#.NET?

Q. Which of the following is not a namespace in the .NET Framework Class Library?

Q. Which of the following C#.NET code snippets will correctly print "Hello C#.NET"?

Q. Which of the following statements is correct about a namespace used in C#.NET?

Q. Which of the following CANNOT belong to a C#.NET Namespace?

Q. Which of the following statements is correct about the using statement used in C#.NET?

Q. Which of the following statements is correct about namespaces in C#.NET?

Q. If a class called Point is present in namespace n1 as well as in namespace n2, then which of the following is the correct way to use the Point class?

Q. Which of the following is absolutely neccessary to use a class Point present in namespace Graph stored in library?