Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
void Funct();
4.
int main()
5.
{
6.
try {
7.
Funct();
8.
}
9.
catch(double) {
10.
cerr
Options:
A .  caught a double type
B .  compile time error
C .  abnormal program termination
D .  none of the mentioned
Answer: Option C

As we are throwing integer to double it will raise as abnormal program after termination throw 

statement.
Output:
$ g++ excep4.cpp
$ a.out
terminate called after throwing an instance of ‘int’
Aborted



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers