Q325
What will be the output of the following C++ code? #include #include using namespace std; void myunexpected () cout << "unexpected handler called "; throw; void myfunction () throw (int,bad_exception) throw 'x'; int main (void) set_unexpected (myunexpected); try myfunction(); catch (int) cout << "caught int "; catch (bad_exception be) cout << "caught bad_exception "; catch (...) cout << "caught other exception "; return 0;
A.
unexpected handler called
B.
caught bad_exception
C.
caught other exception
D.
both unexpected handler called & caught bad_exception
AnswerAnswer: Option D
Solution
Answer: Option D
No explanation is given for this question Let's Discuss on Board