Friday, May 23, 2014

Exception handling mechanism of C#.Net Interview Questions(10)

Exception handling mechanism of C#.Net Interview Questions(10)





1.What is Exception?
A)An exception is an abnormal termination of a program execution.
                                 (Or)
    A runtime error is known as an exception.


2.What are the methods to handle exception?
A)There are three methods to handle the except.They are:
           Ø  Logical Implementation
           Ø  Try catch Implementation
     Ø  On error go to Implementation
3.Can we use exceptions in C#?
A)Yes.

4.What types of object can I throw as exceptions?
A)Only instances of the System.Exception classes, or classes derived from System.Exception.

5.Can we define my own exceptions?
A)Yes.We can derive your exception class from System.Exception.

6.Can we use multiple catch blocks?
A)Yes.We can declare multiple catch blocks if required.

7.In usage of try block is catch block is required?
A)Yes minimum of one catch block is required mandatory.

8. Does C# have a 'throws' clause?
A)No, unlike Java, C# does not require (or even allow) the developer to specify the exceptions that a method can throw.

9. What is the use of throw keyword in C#?
A)The throw keyword is used to throw an exception programmatically in C#. In .NET, there is an in-built technique to manage & throw exceptions. In C#, there are 3 keyword that are used to implement the Exception Handling. These are the try, catch and finally keywords.
In case an exception has to be implicitly thrown, then the throw keyword is used.

10.What are the properties with exception classes?
A)Exception class consists of three properties.They are:
               Ø  Message
               Ø  Source
               Ø  Helplink

0 comments:

Post a Comment