Skip to content

Tag Archives: C++-Exception Handling

Exception Handling is one of the most important topics from the C++ Interview perspective. Exception handling is an effective means to handle the runtime errors… Read More
In this article, we will discuss how to handle the exceptions using classes. Exception Handling: Exceptions are run-time anomalies or abnormal conditions that a program… Read More
What is undeclared Error: When we use some constant in our program maybe they are built-in constant and may be created by a user according… Read More
C++ provides a list of standard exceptions defined in header <exception> in namespace std where “exception” is the base class for all standard exceptions. All… Read More
We can use Exception handling with class too. Even we can throw an exception of user defined class types. For throwing an exception of say… Read More
What happens when a function throws an error but doesn’t specify it in the list of exceptions it can throw. For example, what is the… Read More
What happens in C++ when an exception is thrown and not caught anywhere like following program. #include <iostream> using namespace std;    int fun() throw… Read More
Which of the following is true about exception handling in C++? 1) There is a standard exception class like Exception class in Java. 2) All… Read More
#include <iostream> using namespace std;    class Test {   static int count;   int id; public:   Test() {     count++;     id = count;     cout << "Constructing object… Read More
#include <iostream> using namespace std;    class Test { public:    Test() { cout << "Constructing an object of Test " << endl; }   ~Test() {… Read More
#include <iostream> using namespace std;    int main() {     try     {         try         {             throw 20;         }         catch (int n)         {             cout << "Inner Catch\n";             throw;… Read More
#include <iostream> using namespace std;    int main() {     try     {        throw 10;     }     catch (...)     {         cout << "default exception\n";     }     catch (int param)… Read More
#include <iostream> using namespace std;    int main() {     try     {        throw 'a';     }     catch (int param)     {         cout << "int exception\n";     }     catch (...)… Read More
Output of following program #include<iostream> using namespace std;    class Base {}; class Derived: public Base {}; int main() {    Derived d;    try {        throw… Read More
What should be put in a try block? 1. Statements that might cause exceptions 2. Statements that should be skipped in case of an exception… Read More

Start Your Coding Journey Now!