Vidyalelo
C++ Programming · Q997

C++ miscellaneous

Programming · C++ Programming · question 997

Q997

What will be the output of the following C++ code? #include using namespace std; int main() int x = -1; try if (x < 0) throw x; else cout<<x; catch (int x ) cout << "Exception occurred: Thrown value is " << x << endl; return 0;

A.
-1
B.
0
C.
Exception occurred: Thrown value is -1
Answer
D.
Error

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board