Home / MCQ Bank / Computer
Computer Plus Plus Miscellaneous Difficulty: Medium

What will be the output of the following C++ code? #include <iostream> #include <string> using namespace std; int main () { int num = 3; string str_bad = "wrong number used"; try { if ( num == 1 ) { throw 5; } if ( num == 2 ) { throw 1.1f; } if ( num != 1 || num != 2 ) { throw str_bad; } } catch (int a) { cout << "Exception is: " << a << endl; } catch (float b) { cout << "Exception is: " << b << endl; } catch (...) { cout << str_bad << endl; } return 0; }

Select the correct option to test your answer:

More Computer Questions

Which variable is set to zero when automatic privilege granting is not needed? Business Intelligence (BI) reporting systems cannot do which of the following operations? Which of these keywords is used to define interfaces in Java? Which C++ keyword is used to access the base class within a derived class? Which of the following folders is commonly used to store any deleted emails?