Question
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int x = -1;
6.
try
7.
{
8.
if (x < 0)
9.
{
10.
throw x;
11.
}
12.
else
13.
{
14.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int x = -1;
6.
try
7.
{
8.
if (x < 0)
9.
{
10.
throw x;
11.
}
12.
else
13.
{
14.
cout
Answer: Option C
Was this answer helpful ?
As the given value is -1 and according to the condition, We are arising an exception.
Output:
$ g++ etae.cpp
$ a.out
Exception occurred: Thrown value is -1
Was this answer helpful ?
Submit Solution