Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
int main ()
4.
{
5.
try
6.
{
7.
throw 20;
8.
}
9.
catch (int e)
10.
{
11.
cout
Options:
A .  20
B .  An exception occurred
C .  error
D .  An exception occurred 20
Answer: Option D

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



Was this answer helpful ?
Next Question

Submit Solution

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

Latest Videos

Latest Test Papers