adplus-dvertising
frame-decoration

Question

Select the output for the following set of Code:
static void Main(string[] args)
 {
     char ch = Convert.ToChar('a' | 'b' | 'c');
     switch (ch)
     {
     case 'A':
     case 'a':
         Console.WriteLine("case A|case a");
         break;
     case 'B':
     case 'b':
         Console.WriteLine("case B|case b");
         break;
     case 'C':
     case 'c':
     case 'D':
     case 'd':
         Console.WriteLine("case D|case d");
         break;
     }
     Console.ReadLine();
 }

a.

Compile time error

b.

case A|case a

c.

case B|case b

d.

case D|case d

Posted under C# programming

Answer: (d).case D|case d

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Select the output for the following set of Code: