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

1 Answer

Answer :

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

Related questions

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

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

Description : Can multiple catch blocks be executed?

Last Answer : 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. 

Description : Can C# have multiple catch blocks?

Last Answer : Yes

Description : Can we execute multiple catch blocks in C#?

Last Answer : No. Once an exception has occurred it executes specific exception catch block and the control comes out.

Description : Write some try…catch…finally code.

Last Answer : // try-catch-finally using System; public class TCFClass { public static void Main () { try { throw new NullReferenceException(); } catch(NullReferenceException e) { Console.WriteLine("{0} exception 1 ... ("exception 2."); } finally { Console.WriteLine("finally block."); } } }

Description : Can we have only “try” block without “catch” block in C#?

Last Answer : Yes, we can have only try block without catch block.

Description : Write the syntax of try-catch-finally blocks.

Last Answer : try{ //Statements to be monitored for any exception } catch(ThrowableInstance1 obj) { //Statements to execute if this type of exception occurs } catch(ThrowableInstance2 obj2) { //Statements }finally{ //Statements which should be executed even if any exception happens }

Description : In Visual Basic .NET or Visual C# programming, when would you use Structured Query Language (SQL)? How are they executed? 

Last Answer : ADO.NET handles most of the database communication for you behind-thescenes. You would only use SQL statements when generating ad-hoc queries for the database. You execute SQL statements by ... returning statements, such as DELETE, INSERT INTO, or UPDATE statements, use the ExecuteNonQuery method.

Description : Will the finally block get executed if an exception has not occurred?

Last Answer : Yes.  

Description : Will the finally block get executed if an exception has not occurred?

Last Answer : Yes. 

Description : What’s the C# syntax to catch any possible exception?

Last Answer : 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 {}.

Description : What’s the C# syntax to catch any possible exception?

Last Answer : 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 {}.

Description : Can you store multiple data types in System.Array?

Last Answer : No. 

Description : What happens if you inherit multiple interfaces and they have conflicting method names?

Last Answer : It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate 

Description : Can you inherit multiple interfaces?

Last Answer : Yes. .NET does support multiple interfaces. 

Description : Can you store multiple data types in System.Array?

Last Answer : No.

Description : Does C# support multiple-inheritance?

Last Answer : No. 

Description : Can you inherit from multiple interfaces?

Last Answer : Yes

Description : Does C# supports multiple inheritance? 

Last Answer : No

Description : Can you increment multiple variables in a for loop control?

Last Answer : Yes – e.g. for (int i = 1; j = 2;i

Description : What happens if you inherit multiple interfaces and they have conflicting method names?

Last Answer : It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay.  To Do: Investigate 

Description : Can you inherit multiple interfaces?

Last Answer : Yes. .NET does support multiple interfaces.

Description : Can you store multiple data types in System.Array?

Last Answer : No.

Description : Does C# support multiple-inheritance?

Last Answer : No.

Description : Can you inherit multiple interfaces? 

Last Answer : Yes, why not. 

Description : Does C# support multiple inheritance? 

Last Answer : No, use interfaces instead.

Description : Can a class or a struct have multiple constructors?

Last Answer : Yes, a class or a struct can have multiple constructors. Constructors in C# can be overloaded.

Description : How does a try statement determine which catch clause should be used to handle an exception?

Last Answer : Ans. When an exception is thrown within the body of a try statement, the catch clauses of the try statement are examined in the order in which they appear. The first catch clause that is capable of handling the exception is executed. The remaining catch clauses are ignored.

Description : What are the four major parts of a SQL SELECT statement? Briefly describe each one.

Last Answer : The four major parts of a SELECT statement are SELECT, FROM, WHERE, and ORDER BY. SELECT specifies the fields to be retrieved. FROM specifies the table from which the records are to be retrieved. WHERE ... the records to be retrieved, and ORDER BY allows you to specify a sort order for the records.

Description : What does the fixed statement do? 

Last Answer : Prevents relocation of a variable by GC. 

Description : What is the using statement for?

Last Answer : The using statement defines a scope at the end of which an object will be disposed.

Description : Write code for a case statement. 

Last Answer : switch (n) { case 1: x=1; break; case 2: x=2; break; default: goto case 1; }

Description : Define what does a break statement do in switch statements?

Last Answer : The break statement terminates the loop in which it exists. It also changes the flow of the execution of a program. In switch statements, the break statement is used at the end of a case ... break statement is mandatory in C# and it avoids the fall through of one case statement to another.

Description : Define what is the use of the return statement?

Last Answer : The return statement is associated with procedures (methods or functions). On executing the return statement, the system passes the control from the called procedure to the calling procedure. This ... the currently executed code to return some value to the caller of the currently executed code.

Description : Define what is the use of a goto statement?

Last Answer : The goto statement is also included in the C# language. This goto can be used to jump from inside a loop to outside. But jumping from outside to inside a loop is not allowed.

Description : Define what is the difference between break and continue statement?

Last Answer : The break statement is used to terminate the current enclosing loop or conditional statements in which it appears. We have already used the break statement to come out of switch statements. The ... statement stops the current iteration and simply returns control back to the top of the loop.

Description : A king decided to let a prisoner try to escape the prison with his life. The king placed 2 marbles in a jar that was glued to a table. One of the marbles was supposed to be black, and one was ... and that the prisoner was mute so he could not say anything, how did he escape with his life? -Riddles

Last Answer : The prisoner grabbed one of the marbles from the jar and concealed it in his hand. He then swallowed it, and picked up the other marble and showed everyone. The marble was black, and since the other marble was swallowed, it was assumed to be the blue one. So the mean king had to set him free

Description : Suppose d = { john :40, peter :45}, what happens when we try to retrieve a value using the expression d[ susan ]? a) Since susan is not a value in the set, Python raises a KeyError ... Python raises a KeyError exception d) Since susan is not a key in the set, Python raises a syntax error

Last Answer : c) Since “susan” is not a key in the set, Python raises a KeyError exception

Description : A bond that is executed for warehousing of goods imported in multiple imports is referred to as _____ bond. A Special B General C Higher D Lower

Last Answer : Ans :Higher

Description : Early success: What are practical examples that show it's better to do your best early, rather than try to catch up in the middle or end?

Last Answer : Well, this isn't really a real life example, But the story of the Tortoise and the Hare seems to teach this lesson pretty well. But if your entertaining college students, You might want to go with ... frat guy who both had to study for the same statistics exam. and well you can see the parallels.

Description : I am present on a winter's day, Surprise me and I am taken away. The faster you run, the harder I am to catch, Try all you can, I am not easy to snatch. I am always with you, somewhere in the ... a sound. Keep your head cool and you will finally see, That I am inside you. What could I be? -Riddles

Last Answer : Your breath.

Description : The Keywords - try, catch, and finally are typically used in the sequence: a) Finally, Try and Catch b) Try, Finally and Catch c) Try, Catch and Finally d) Catch, Try and Finally e) None of The Above

Last Answer : c) Try, Catch and Finally

Description : What is try-catch block?

Last Answer : A: try-catch block is a way to handle exceptions in Java. try contains a block of statements to check for any error. If any error occurs within the try block, it is trapped. Further a report is passed to the exception handler about the error, which is done by the catch block.

Description : Suppose your colleague either commits theft or torn out your postage from school due to jealously. How would you overcome this problem? Options: A) You catch the culprit red-handed and abuse him B) You try ... him a lesson C) Once you catch him and warn him severely D) You insult him in public

Last Answer : C) Once you catch him and warn him severely 

Description : You are about to be executed, but the king gives you a chance. He says that he will divide 100 marbles in half. 50 of them are black and 50 are white. You can arrange them however you like into two ... one you die. How do you divide the marbles so there is a 50-50 chance you will live? -Riddles

Last Answer : You need to put one white marble in one of the bowls. Then the remaining 49 go with the 50 black marbles. Then you will have a good chance of living.

Description : What si the difference between interface and abstractclass Select Answer:  1. interface contain only methods  2. we can't declare a variable for interface  3. interface contain only events  4. None  5. All

Last Answer : Ans : 2 The only Difference between Interface and Abstract class is we can declare a variable in abstract class but we can't declare in variable interface

Description : What is the lifespan for items stored in ViewState? Select Answer:  1. Item stored in ViewState exist for the life of the current page  2. Item stored in ViewState exist for the life ... of the current Applicaiton  4. Item stored in ViewState exist for the life of the current configuration

Last Answer : 1. Item stored in ViewState exist for the life of the current page AS any web application works on request and response basis ,so on every post backs, The data in control gets lost. To retain page ... control with data. The life cycle of the view state exist for life of current running page only. 

Description : Which one of the following tools is used to view the metadata information contained in a .NET assembly? Select Answer:  1. al.exe  2. ilasm.exe  3. vbx.exe  4. csc.exe  5. ildasm.exe

Last Answer :  5. ildasm.exe

Description : How would you ensure that all relevant registry entries were removed in the event that installation of your application failed?

Last Answer : You can ensure that registry entries are removed, as well as perform any other “clean-up” tasks, by creating an Installer class and writing the appropriate code in the Rollback event handler. Then create a new Custom Action and set the InstallerClass, and EntryPoint properties to appropriate values.