Home » C++ Programming » Exception Handling » Question
  1. What is the output of this program?
    #include 
    using namespace std;
    void function();
    int main()
    {
    try
    {
    function();
    }
    catch(double)
    {
    cout << "caught a double type exception..." << endl;
    }
    return 0;
    }
    void function()
    {
    throw 5;
    }
    1. abnormal program termination
    2. caught a double type
    3. Compilation Error
    4. Runtime Error
    5. None of these
Correct Option: A

As we are throwing integer to double it will raise as abnormal program after termination throw statement.



Your comments will be displayed only after manual approval.