What will be the output of the following C# code snippet? [code] class Program { public static void Main(string[] args) {

Ngọc Trâm

New member
What will be the output of the following C# code snippet?
Code:
 class Program
 {
     public static void Main(string[] args)
     {
         try
         {
             int a = args.Length;
             int b = 10 / a;
             Console.WriteLine(a);
             try
             {
                 if (a == 1)
                 a = a / a - a;
                 if (a == 2)
                 {
                     int[] c = { 1 };
                     c[8] = 9;
                 }
             }
             catch (IndexOutOfRangeException e)
             {
                 Console.WriteLine("TypeA");
             }
         }
         catch (ArithmeticException e)
         {
             Console.WriteLine("TypeB");
         }
         Console.ReadLine();
     }
 }
A. TypeA
B. TypeB
C. 0TypeA
D. Compile time error
 

Tìm kiếm

Back
Top