Vidyalelo
C++ Programming · Q789

C++ miscellaneous

Programming · C++ Programming · question 789

Q789

What will be the output of the following C++ code? #include using namespace std; void test(int x) try if (x > 0) throw x; else throw 'x'; catch(char) cout << "Catch a integer and that integer is:" << x; int main() cout << "Testing multiple catches :"; test(10); test(0);

A.
Catch a integer and that integer is:10
B.
Error
C.
Runtime error
Answer
D.
Catch a integer and that integer is:25

Answer: Option C

Solution

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