Uncaught Exceptions

1

What will not be called when the terminate() is arised in constructor?

A. main()
B. class
C. destructor
D. none of the mentioned

2

What function will be called when we have a uncaught exception?

A. catch
B. throw
C. terminate
D. none of the mentioned

3

What is the output of this program?

1.
    #include 
2.
    using namespace std;
3.
    #include 
4.
    #include 
5.
    void Funct()
6.
    {
7.
        cout << "Funct() was called by terminate()." << endl;
8.
        exit(0);
9.
    }
10.
    int main()
11.
    {
12.
        try
13.
        {
14.
            set_terminate(Funct);
15.
            throw "Out of memory!";
16.
        }
17.
        catch(int)
18.
        { 
19.        
            cout << "Integer exception raised." << endl;
20.
        }
21.
        return 0;
22.
    }
A. Integer exception raised.
B. Funct() was called by terminate().
C. both a & b
D. none of the mentioned

4

What is the output of this program?

1.
    #include 
2.
    using namespace std;
3.
    class Test1 
4.
    { 
5.
    };
6.
    class Test2 : public Test1 { };
7.
    void Funct();
8.
    int main()
9.
    {
10.
        try
11.
        {
12.
            Funct();
13.
        }
14.
        catch (const Test1&)
15.
        {
16.
            cerr << "Caught a exception" << endl;
17.
        }
18.
        return 0;
19.
    }
20.
    void Funct()
21.
    {
22.
        throw Test2();
23.
    }
A. Caught an exception
B. NULL
C. both a & b
D. none of the mentioned

5

What is the output of this program?

1.
    #include 
2.
    #include 
3.
    #include 
4.
    using namespace std;
5.
    void myterminate () 
6.
    {
7.
        cerr << "terminate handler called";
8.
        abort();
9.
    }
10.
    int main (void) 
11.
    {
12.
        set_terminate (myterminate);
13.
        throw 0; 
14.
        return 0;
15.
    }
A. terminate handler called
B. Aborted
C. both a & b
D. none of the mentioned