Home / C# Programming / Control Instructions - c# :: Discussion

Discussion :: Control Instructions - c#

  1. What will be the output of the C#.NET code snippet given below?

      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;
     }
    

  2. A.

    case A | case a

    B.

    case B | case b

    C.

    case D | case d

    D.

    Compile Error

    E.

    No output

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    No answer description available for this question.


Be The First To Comment