Home » C++ Programming » Exception Handling » Question
  1. What is the output of this program?
    #include <iostream>
    #include <exception>
    using namespace std;
    int main()
    {
    try
    {
    double* number= new double[200];
    cout << "Memory allocated...";
    }
    catch (exception& excep)
    {
    cout << "Exception occurred:" << excep.what() << endl;
    }
    return 0;
    }
    1. Memory allocated...
    2. Compilation Error
    3. Exception occurred...
    4. Runtime Error
    5. None of these
Correct Option: A

The value will be allocated, if there is enough memory in the system.



Your comments will be displayed only after manual approval.