In this Sample Code which catch block will be executed?
try
{
int j=10;
try
{
int i=10;
j=j-i;
j=i/j;
}
catch(Exception ex)
{
throw ex;
}
}
catch(Exception ex)
{
throw ex;
}

 Posted by Lakhangarg on 9/12/2009 | Category: C# Interview questions | Views: 18852
Select from following answers:
  1. First Catch Block
  2. Second Catch Block
  3. Both
  4. None
  5. All Above

Show Correct Answer


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Jasc on: 10/13/2011 | Points: 10
Please Correct the Answer, the Second Catch Block will be executed.
Posted by: Eitkin on: 9/19/2015 | Points: 10
This is not a correctly formed question. The answer is wrong. Compiler will complain that of same Exception type in more than one catch blocks.

Login to post response