Question
1.
#include
2.
using namespace std;
3.
int main ()
4.
{
5.
try
6.
{
7.
throw 20;
8.
}
9.
catch (int e)
10.
{
11.
cout
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
Answer: Option D
Was this answer helpful ?
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 ?
More Questions on This Topic :
Question 2.
Which is used to throw a exception?
....
Question 3.
What is the use of the 'finally' keyword?
....
Submit Solution