MCQs
None.
If there is many number of exceptions in the program means, We have to use multiple catch
statement and it is hard to keep track of the program.
Answer:c
Explanation:In this program, We are printing one and raising a exception at 2.
Output:
$ g++ gex4.cpp
$ a.out
1
exception: 2
We are passing the integer and character and catching it by using multiple catch statement.
Output:
$ g++ gex3.cpp
$ a.out
integer:10character:x
We are manipulating the values, if there is any infinite value means, it will raise an exception.
Output:
$ g++ gex2.cpp
$ a.out
-3
If we caught a integer value means, there will be an exception, if it is not a integer, there will
not be a exception.
Output:
$ g++ gex1.cpp
$ a.out
exception number: 1
There are four runtime error messages associated with exceptions.They are overflow_error,
range_error, system_error and underflow_error.
There are two types of exception handling in c++. They are synchronous exception handling and
asynchronous exception handling.
In this program, We are dividing the two variables and printing the result. If any one of the operator
is zero means, it will arise a exception.
Output:
$ g++ gex.cpp
$ a.out
10 / 5 =2
None.