Vidyalelo
C++ Programming · Q967

C++ miscellaneous

Programming · C++ Programming · question 967

Q967

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(int x) cout<<"integer:"<<x; catch(char x) cout << "character:" << x; int main() test(10); test(0);

A.
integer:10character:x
Answer
B.
integer:10
C.
character:x
D.
character:10

Answer: Option A

Solution

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