Home » C++ Programming » Exception Handling » Question
  1. What is the output of this program?
    #include <iostream>
    using namespace std;
    int main ()
    {
    try
    {
    throw 15;
    }
    catch (int e)
    {
    cout << "Exception occurred..." << e << endl;
    }
    return 0;
    }
    1. 15
    2. Exception occurred...
    3. Compilation Error
    4. Exception occurred...15
    5. None of these
Correct Option: D

We are handling the exception by throwing that number. So the output is printed with the given number.



Your comments will be displayed only after manual approval.