Vidyalelo
C++ Programming · Q305

C++ miscellaneous

Programming · C++ Programming · question 305

Q305

What will be the output of the following C++ code? #include #include #include #include using namespace std; int main() vector vec; vec.push_back(10); int i = vec[100]; try i = vec[0]; cout << i << endl; catch (exception &e) cout << "Caught: " << e.what( ) << endl; cout << "Type: " << typeid( e ).name( ) << endl; catch (...) cout << "Unknown exception: " << endl; return 0;

A.
10
Answer
B.
100
C.
Exception
D.
Error

Answer: Option A

Solution

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