Exception Handling Questions and Answers

By
1. ) What is Exception Handling in c# ?                                                                           
In Exception handling,we provide an alternate path,if some error occurs at run time instead of  halting the programs.

2. ) What is Debugging ?                                                                                                      
Debugging is the process of identifying and fixing errors in a software program.

3. ) What are the types of error in c# ?                                                                            
There are three types of error ,which are given below:-
  • Compile time error
  • Runtime error
  • Logical error
4. ) What is compile time error  in c# ?                                                                           
Compile time error generally occurs because of syntax error in the program.

5. ) What is Run time error  in c# ?                                                                                  
Runtime error occurs when application is running but some logic is failed according to CLR. 

6. ) What is Logical error  in c# ?                                                                                      
Program is compiling and running successfully but we are not getting expected output due to not written correct logic.

7. ) What are the types of exceptional classes in c# ?                                                   
  • Application class
  • System class
8. ) What is the syntax of exception handling ?                                                             
try
{
      Statement that cause the exception
     .......................................................
}
catch(Exception ex)
{
statement that handle the exception
.........................................................
}
finally
{
statements that execute always.
}

9. ) What is throw() method in exception handling ?                                                   
 Most  often ,exception are thrown by methods that are invoked from within the try block .The point at which one exception is thrown is called the throw point.
More Details...

10. ) What is the purpose to use  exception handling ?                                               
The main purpose of the exception handling mechanism is to provide a means to detect and report an "Exceptional statement" so that appropriate action can be taken.

11. ) Can we use multiple catch block in exception handling ?                                   
Yes.

12. ) Can we use nested try block in exception handling ?                                           
Yes.

0 comments:

Post a comment

Powered by Blogger.