Question
#include <vector>
#include <iostream>
#include <typeinfo>
#include <stdexcept>
using namespace std;
int main()
{
vector<int> 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
b.
100
c.
Exception
d.
Error
Posted under Object Oriented Programming Using C++
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of this program?
Similar Questions
Discover Related MCQs
Q. What does the checked iterator allow you to find?
View solution
Q. What kind of errors do checked iterators detect?
View solution
Q. Where are allocators used?
View solution
Q. Where are allocators implemented?
View solution
Q. Which operator is used to allocate the memory?
View solution
Q. Which operator is used to deallocate the memory?
View solution
Q. Which header file is used to manipulate the allocater?
View solution
Q. What is the use of reference member type in allocator?
View solution
Q. What is the correct syntax for declaring an allocator?
View solution
Q. The break statement is used in
View solution
Q. An object whose value cannot be changed is called
View solution
Q. The label in Goto statement is same like
View solution
Q. In C++ even the simplest floating point value tend to be imprecise, this imprecision is called
View solution
Q. Iteration is the repetition of a
View solution
Q. Which from the following is a real number type?
View solution
Q. The for loop is controlled by how many separate parts?
View solution
Q. Which from the following data type is allocated with 8 bytes in C++?
View solution
Q. What is an infinite loop?
View solution
Q. An object is a contiguous region of memory that has
View solution
Q. The statements that causes the control program to jump over the other statements, is called
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Object Oriented Programming Using C++? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!
Microprocessor
Understand the heart of your computer with our Microprocessor MCQs. Topics include...
Java Programming
Level up your coding skills with our Java Programming MCQs. From object-oriented...