.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Imran Ghani

Home >> Interview Question >> .NET Framework >> Post New Question Subscribe to Interview Questions

Can multiple catch blocks be executed for a single try statement?

Posted By :Amit Mehra     Posted Date :October 15, 2009    Points :10   Category :.NET Framework 
No. Once the proper catch block processed, control is transferred to the finally block (if any).

So we can not execute multiple catch block in one try block

You can also find related Interview Question to Can multiple catch blocks be executed for a single try statement?  below: 

Can multiple catch blocks be executed for a single try statement?

No. Once the proper catch block processed, control is transferred to the finally block (if there are any). (More...)

Can we put multiple catch blocks in a single try statement in C#?

Yes. Multiple catch blocks may be put in a try block. (More...)

Can multiple catch blocks be executed?

No, once the proper catch code fires off, the control is transferred to the finally block (if there are any), and then whatever follows the finally block. (More...)

Can code inside multiple catch block be executed?

No, Code can not execute in mutiple catch block (More...)

Is Multiple Pages possible In Single asp.net Page?

We can achieve this in simple way by using FrameSet .... (More...)

Populate multiple controls from DB in a single function using a single DataSet

Step 1:
- Write the different queries for getting the data from the DB for different controls in a single string variable by separating them with semicolon.

Ex -
//Create the SQL query.
string selectQueryForControlPopulation =
Step 2:
- Create the DataAdapter, DataSet object. Execute the query and fill the DataSet object.

Ex -
//Create the Connection object.
OleDbConnection oConnection = new OleDbConnection(ConfigurationSettings.AppSettings["SQLConnectionString"]);

//Create the Command object.
OleDbCommand oCommand = new OleDbCommand(selectQueryForControlPopulation , oConnection );

//Create the DataAdapter object and set its property.
OleDbDataAdapter oAdapter = new OleDbDataAdapter();
oAdapter .SelectCommand = oCommandPopulateOrganizations;

// Create a DataSet object.
DataSet oDataSet = new DataSet();

//Filling the DataSet object.
oAdapter .Fill(oDataSet);

(**) The DataSet object contain the result of different queries as different tables. We can access those table to fill our controls.

http://www.mindfiresolutions.com/Populate-multiple-controls-from-DB-in-a-single-function-using-a-single-DataSet-831.php (More...)

What's the C# equivalent of C++ catch (.), which was a catch-all statement for any possible exception?

A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}. (More...)

You are designing a single person shooter game application. The player can choose between multiple guns.
1) Pistol with 5 bullets
2) Shotgun with 100 bullets
3) Grenade Launcher with 20 grenades

Each gun will have different sound effects and graphics.

Pressing Ctrl+Space should rotate between guns.
Which design pattern should you employ for this?

Use Strategy Pattern.

Explanation: Each gun having different performance and graphics.
So this can be accomodated in the algorithm.

Strategy pattern is best suited for shifting the guns/algorithms

There will be a IGun interface implemented by 3 classes
Pistol : IGun
Shotgun : IGun
GrenadeLauncher : IGun (More...)

Can we add multiple script managers on a single page?

No it will throw error, a page can contain only one ScriptManager control in its hierarchy. To register services and scripts for nested pages, user controls, or components when the parent page already has a ScriptManager control, use the ScriptManagerProxy control.

The purpose of ScriptManager is just to enables AJAX In Your Web Application. so adding multiple ScriptManager doesn't make any sense. (More...)

Does C# support multiple inheritance?


C# does not support multiple inheritance. A class can inherit from maximum one base class, although it can implement any number of interfaces. Like Java, C# does not support multiple inheritance, meaning that classes cannot inherit from more than one class (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend