MCQs
bad_cast exception is thrown by dynamic_cast.
None.
We are defining the user-defined exception in this program.
Output:
$ g++ excep4.cpp
$ a.out
C++ Exception
Exception caught
In this program, We are allocating the memory for array. If it is allocated means, no exception
will arise and if there is no size in memory means, Exception will arise.
Output:
$ g++ excep3.cpp
$ a.out
allocated
This is a standard exception handler used in the class.
Output:
$ g++ excep2.cpp
$ a.out
My exception
We are handling the exception by throwing that number. So the output is printed with the given number.
Output:
$ g++ excep1.cpp
$ a.out
An exception occurred 20
It's a mathematical certainty, We can't divide by zero, So we're arising a exception.
Output:
$ g++ excep.cpp
$ a.out
Division by zero condition!
finally keyword will be executed at the end of all the exception.
When we found a exception in the program, We need to throw that and we handle that by using