My Report

C# Exception Handling Test – 1


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. Which of the following is the object oriented way to handle run time errors?

2. Select the correct statement about an Exception?

3. What will be the output of the following C# code?

 class program
 {
     static void main(string[] args)
     {
         int i = 5;
         int v = 40;
         int[] p = new int[4];
         try
         {
             p[i] = v;
         }
         catch(IndexOutOfRangeException e)
         {
             Console.WriteLine("Index out of bounds");
         }
         Console.WriteLine("Remaining program");
     }
 }

4. What will be the output of the following C# code?

  class Program
  {
      static void Main(string[] args)
      {            
          try 
          {
              Console.WriteLine("csharp" + " " + 1/0);
          }
          finally
          {
              Console.WriteLine("Java");        	
          }
          Console.ReadLine();
      }
  }

5. Which among the following is considered as .NET Exception class?

6. What will be the output of the following C# code?

 static void Main(string[] args)
 {            
     try 
     {
         Console.WriteLine("csharp" + " " + 1/Convert.ToInt32(0));
     }
     catch(ArithmeticException e) 
     {
         Console.WriteLine("Java");        	
     }
     Console.ReadLine();
 }

7. Which of the following is the wrong statement about exception handling in C#.NET?

8. Which among the following is NOT an exception?

9. Which of these keywords is used to manually throw an exception?

10. Select the statements which describe the correct usage of exception handling over conventional error handling approaches?

11. Which of these keywords is not a part of exception handling?

12. Which of these keywords must be used to monitor exceptions?


 

Start practicing “1000 MCQs on C#”, and once you are ready, you can take tests on all topics by attempting our “C# Test Series”.

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.