Which code segment should you use?

You are an enterprise application developer. You are working on a component in an application that provides a business workflow solution. The component will be used as a workflow to manage purchase requisitions. You discover that a WebException is raised when you use the GetApprover private method to invoke a method of a Web Service.
You need identify a code that allows the component to invoke the following methods:
* The GetDefaultApprover method if a WebException is raised
* The ReportError method if any other exception is raised.
* The GoToNextStep method if no exception is raised.

Which code segment should you use?

You are an enterprise application developer. You are working on a component in an application that provides a business workflow solution. The component will be used as a workflow to manage purchase requisitions. You discover that a WebException is raised when you use the GetApprover private method to invoke a method of a Web Service.
You need identify a code that allows the component to invoke the following methods:
* The GetDefaultApprover method if a WebException is raised
* The ReportError method if any other exception is raised.
* The GoToNextStep method if no exception is raised.

Which code segment should you use?

A.
try
{
GetApprover ();
GoToNextStep();
}
catch (WebException ex)
{
GetDefaultApprover ();
}
catch (Exception ex)
{
ReportError();
}

B.
try
{
GetApprover ();
GoToNextStep();
}
catch (WebException ex)
{
GetDefaultApprover ();
}
catch (SqlException ex)
{
ReportError();
}

C.
try
{
GetApprover ();
}
catch (WebException ex)
{
GetDefaultApprover ();
}
catch (Exception ex)
{
ReportError();
}
finally
{
GoToNextStep();
}

D.
try
{
GetApprover ();
}
catch (WebException ex)
{
GetDefaultApprover ();
}
catch (SqlException ex)
{
ReportError();
}
finally
{
GoToNextStep();
}



Leave a Reply 0

Your email address will not be published. Required fields are marked *