41.
What will be the output of the following C# code snippet?
{
    try 
    {
        int a, b;
        b = 0;
        a = 10 / b;
        Console.WriteLine("A");
    }
    catch(ArithmeticException e) 
    {
        Console.WriteLine("B");        	
    }
    Console.ReadLine();
}

42.
What will be the output of the following C# code snippet?
class Output 
{
    public static void main(String args[]) 
   {
       try 
       {
           int a = 0;
           int b = 5;
           int c = a / b - 5;
           Console.WriteLine("C");
       }
       finally 
       {
           Console.WriteLine("sharp");
       } 
   }
}

43.
What will be the output of the following C# code?
{
    try 
    {
        int i, sum;
        sum = 10;
        for (i = -1 ;i < 3 ;++i) 
        {
            sum = (sum / i);
            Console.WriteLine(i);
        }
    }
    catch(ArithmeticException e) 
    {
        Console.WriteLine("0");
    }
    Console.ReadLine();
}

44.
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();
}

45.
What will be the output of the following C# code snippet?
class Program
{
    public static void Main(string[] args)
    {
        try
        {
            int a = 1;
            int b = 10 / a;
            try
            {
                if (a == 1)
                    a = a / a - a;
                if (a == 2)
                {
                    int[] c = { 1 };
                    c[8] = 9;
                }
            }
            finally
            {
                Console.WriteLine("A");
            }
       }
       catch (IndexOutOfRangeException e)
       {
            Console.WriteLine("B");
       }
       Console.ReadLine();
   }
}

47.
What will be the output of the following C# code snippet?
{
    try 
    {
        int a, b;
        b = 0;
        a = 5 / b;
        Console.WriteLine("A");
    }
    catch(ArithmeticException e) 
    {
        Console.WriteLine("B");
    }
    finally
    {
        Console.WriteLine("C");
    }
    Console.ReadLine();
}

50.
What will be the output of the following C# code?
class number
{
    int length = 60;
    public int number1
    {
        get
        {
            return length;
        }
    }
}
class Program
{
    public static void Main(string[] args)
    {
        number p = new number();
        int l;
        l = p.number1 + 40;
        int k = l * 3 / 4;
        Console.WriteLine(k);
        Console.ReadLine();
    }
 }

Read More Section(Exception Handling in C Sharp)

Each Section contains maximum 100 MCQs question on Exception Handling in C Sharp. To get more questions visit other sections.