Vidyalelo
C# Programming · Q99

Exception Handling in C Sharp

Programming · C# Programming · question 99

Q99

What will be the output of the following C# code snippet? 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
Answer
C.
0TypeA
D.
Compile time error

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board