C# Exception MCQs

Question 11: What will be the output of the following program?

public static void Main()
{
	int[] arr = {1, 2, 3, 4, 5};
	try{
        Console.Write(arr[10]);
    }
	finally{
		Console.WriteLine("Error occurred!");
	}
}

Question 12: The finally block is always executed irrespective of whether an exception occurs or not.

Question 13: Which of the following keyword is used to raise an exception manually?

Question 14: Which of the following class should be derived to define the custom exception class?

Question 15: What will be the output of the following program?

static void Main()
{
    try
    {
        test();
    }
    catch (Exception ex) {
        Console.Write("Some exceptions occurred!");
    }
}

static void test() 
{
    string str = null;
    try
    {
        char c = str[0];
    }
    catch (NullReferenceException e){
        Console.WriteLine("Null exception occurred!");
    }
}