Dot Net Interview Questions and Answers Part 31

1. If we write a goto or a return statement in try and catch block will the finally block execute ?

Ans. The code in then finally always run even if there are statements like goto or a return statements.

2. What's the implicit name of the parameter that gets passed into the class' set method?

Ans. Value, and its datatype depends on whatever variable we're changing.

3. What is Indexer?

Ans. An indexer is a member that enables an object to be indexed in the same way as an array.

4. How do you inherit from a class in C#?

Ans. Place a colon and then the name of the base class. Notice that it's double colon in C++.

5. What's the top .NET class that everything is derived from?

Ans. System.Object.

6. Does C# support multiple inheritance?

Ans. No, use interfaces instead.

7. When you inherit a protected class-level variable, who is it available to?

Ans. Derived Classes.

8. Can you change the value of a variable while debugging a C# application?

Ans. Yes, if you are debugging via Visual Studio.NET, just go to Immediate window.

9. In a program there are multiple catch blocks so can it happen that two catch blocks are executed ?

Ans. No, once the proper catch section is executed the control goes finally to block. So there will not be any scenarios in which multiple catch blocks will be executed.

10. Can we have static indexer in C# ?

Ans. No.


Receive Quality Tutorials Straight in your Inbox by submitting your Email below:

Delivered by FeedBurner

Protected by Copyscape Duplicate Content Checker