Error Handling Alternatives

1

What will happen when an exception is not processed?

A. It will eat up lot of memory and program size
B. Terminate the program
C. Crash the compiler
D. None of the mentioned

2

Pick out the correct statement for error handling alternatives.

A. Terminate the program
B. Use the stack
C. exit from the block
D. none of the mentioned

3

How many levels are there in exception safety?

A. 1
B. 2
C. 3
D. 4

4

What is the use of RAII in c++ programing?

A. Improve the exception safety
B. Terminate the program
C. Exit from the block
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 MyFunc(char c)
6.
    {
7.
        if (c < numeric_limits::max())
8.
            return invalid_argument;
9.
    }
10.
    int main()
11.
    {
12.
        try
13.
        {
14.
            MyFunc(256);
15.
        }
16.
        catch(invalid_argument& e)
17.
        {
18.
            cerr << e.what() << endl;
19.
            return -1;
20.
        }
21.
        return 0;
22.
    }
A. 256
B. invalid argument
C. Error
D. None of the mentioned