Vidyalelo
C# Programming · Q44

Exception Handling in C Sharp

Programming · C# Programming · question 44

Q44

What will be the output of the following C# code? try int []a = 1, 2, 3, 4, 5; for (int i = 0; i < 5; ++i) Console.WriteLine(a[i]); int x = (1 / Convert.ToInt32(0)); catch(IndexOutOfRangeException e) Console.WriteLine("A"); catch(ArithmeticException e) Console.WriteLine("B"); Console.ReadLine();

A.
1234
B.
12345
C.
Run time error
D.
12345B
Answer

Answer: Option D

Solution

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