EXCEPTION HANDLER IN C++
Viva Vice on Exception Handler in C++
Q1. Which keyword is used to handle the exception?
ans) catch keyword
Q2. Which keyword is used to throw a exception?
ans) throw keyword
Q3. What is the use of the ‘finally’ keyword?
ans) It will be executed at the end of the program even if the exception arised
Q4. Which exception is thrown by dynamic_cast?
ans) bad_cast
Q5. Which is used to handle the exceptions in c++?
ans) exception handler
Q6. Which type of program is recommended to include in try block?
ans) dynamic memory allocation
Q7. Which statement is used to catch all types of exceptions?
ans) catch(…)
Q8. How to handle error in the destructor?
ans) terminate() function
References:
- Sebesta,”Concept of programming Language”, Pearson Edu
- Louden, “Programming Languages: Principles & Practices” , Cengage Learning
- Tucker, “Programming Languages: Principles and paradigms “, Tata McGraw –Hill.
- E Horowitz, “Programming Languages”, 2nd Edition, Addison Wesley