Examveda

What will be the output of the following C# code?
static void Main(string[] args)
{
    int temp = 1;
    switch (temp << 2 + temp)
    {
    default: 
        Console.WriteLine("Example1");
        break;
    case 4: 
        Console.WriteLine("Example2");
        break;
    case 5: 
        Console.WriteLine("Example3");
        break;
    case 8: 
        Console.WriteLine("Example4");
        break;
    }
    Console.ReadLine();
}

A. Example1

B. Example3

C. Example4

D. Example2

Answer: Option C


Join The Discussion

Related Questions on Control Flow Statements in C Sharp