Home / CSE MCQs / C#.Net MCQs :: Discussion

Discussion :: C#.Net MCQs

  1. 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();
            }
        }
    }
  2. 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

    View Answer

    Workspace

    Answer : Option D

    Explanation :



Be The First To Comment