Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

C++ | Exception Handling | Question 6

  • Last Updated : 28 Jun, 2021


Take a step-up from those "Hello World" programs. Learn to implement data structures like Heap, Stacks, Linked List and many more! Check out our Data Structures in C course to start learning today.



#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

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!