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

What will be the output of the following C++ code? #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; }

Select the correct option to test your answer:

More Computer Questions

What will be the output of the following Python statement? >>>chr(ord('A')) What are the small squares arranged in rows and columns called in Excel? The loss in signal power as light travels down the fiber is called Which attribute is used to define a route in ASP.NET MVC? How many times is the function recursive_dec_to_bin() called when the following code is executed? #include<stdio.h> int arr[31], len = 0; void recursive_dec_to_bin(int n) { if(n == 0 && len == 0) { arr[len++] = 0; return; } if(n == 0) return; arr[len++] = n % 2; recursive_dec_to_bin(n/2); } int main() { int n = 111,i; recursive_dec_to_bin(n); for(i=len-1; i>=0; i--) printf("%d",arr[i]); return 0; }