Vidyalelo
C++ Programming · Q966

C++ miscellaneous

Programming · C++ Programming · question 966

Q966

What will be the output of the following C++ code? #include using namespace std; int main() int var = -12; try cout<<"Inside try "; if (var < 0) throw var; cout<<"After throw "; catch (int var ) cout<<"Exception Caught "; cout<<"After catch "; return 0;

A.
Inside try
Exception Caught
After catch
Answer
B.
Inside try
After throw
After catch
C.
Inside try
Exception Caught
After throw
D.
Inside try
Exception Caught
After throw
After catch

Answer: Option A

Solution

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