Skip to content
Related Articles

Related Articles

C++ | Exception Handling | Question 6
  • Last Updated : 24 Nov, 2013




#include <iostream>
using namespace std;
  
int main()
{
    try
    {
       throw 10;
    }
    catch (...)
    {
        cout << "default exception\n";
    }
    catch (int param)
    {
        cout << "int exception\n";
    }
  
    return 0;
}

(A) default exception
(B) int exception
(C) Compiler Error


Answer: (C)

Explanation: It is compiler error to put catch all block before any other catch. The catch(…) must be the last catch block.

Quiz of this Question

Want to learn from the best curated videos and practice problems, check out the C Foundation Course for Basic to Advanced C.
My Personal Notes arrow_drop_up
Recommended Articles
Page :