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

Variable will be allocated depends on the available space in the memory, If there is no space means, It will throw an exception.



Your comments will be displayed only after manual approval.