Exercise

1. Which keyword is used to handle the expection?

A.Try
B.Throw
C.Catch
D.None of the above

View Answer


2.Which is used to throw a exception?

A.Try
B.Throw
C.Catch
D.None of the above

View Answer


3.Which exception is thrown by dynamic_cast?

A. bad_cast
B. bad_typeid
C. bad_exception
D. bad_alloc

View Answer


4.How do define the user-defined exceptions?

A. Inherting & overriding exception class functionlity
B. Overriding class functionlity
C. Inherting class functionlity
D. None of the above

View Answer


5.We can prevent a function from throwing any exceptions.

A. True
B. False

View Answer


6.In nested try block, if inner catch handler gets executed, then __________?

A. Program execution stops immediately.
B. Outer catch handler will also get executed.
C. Compiler will jump to the outer catch handler and then executes remaining executable statements of main().
D. Compiler will execute remaining executable statements of outer try block and then the main().

View Answer


7.Return type of uncaught_exception() is ___________.

A. int
B. bool
C. char *
D. double

View Answer


8.Which of the following statements are true about Catch handler?
i) It must be placed immediately after try block T.
ii) It can have multiple parameters.
iii) There must be only one catch handler for every try block.
iv) There can be multiple catch handler for a try block T.
v) Generic catch handler can be placed anywhere after try block.

A. Only i, iv, v
B. Only i, ii, iii
C. Only i, iv
D. Only i, ii

View Answer


9.If inner catch handler is not able to handle the exception then__________ .

A. Compiler will look for outer try handler
B. Program terminates abnormally
C. Compiler will check for appropriate catch handler of outer try block
D. None of the above

View Answer


10.Which type of program is recommended to include in try block?

A. Static memory allocation
B. Dynamic memory allocation
C. Const reference
D. Pointer

View Answer


11.Which statement is used to catch all types of exceptions?

A. Catch()
B. Catch(Test t)
C. Catch(…)
D. None of the above

View Answer


12.How to handle error in the destructor?

A. Throwing
B. Terminate
C. Both throwing & terminate
D. None of the above

View Answer


13.What kind of exceptions are available in c++?

A. Handled
B. Unhandled
C. Static
D. Dynamic

View Answer


14.Which of the following is true about exception handling in C++?
i) There is a standard exception class like Exception class in Java.
ii) All exceptions are unchecked in C++, i.e., compiler doesn't check if the exceptions are caught or not.
iii) In C++, a function can specify the list of exceptions that it can throw using comma separated list like following.

A.Only i,iii
B.Only i,ii
C.Only ii,iii
D.All of the above

View Answer


15. What is the basic of grouping standard exception classes,in c++?

A. Catch
B None of these
C. Error
D. Namespace std

View Answer


16.What is a count of standard exception?

A. 9.0
B. 5.0
C. 6.0
D. 7.0

View Answer


17.What should be included in try block in c++ programming language

A. Static value
B. Dynamic allocation
C. None of the above
D. Const value

View Answer


18.How many standard exception exist in c++

A. 9.0
B. 5.0
C. 6.0
D. 7.0

View Answer


19.Catch-all handlers uses which operators in c++?

A. String operators
B. Ternary operators
C. Ellipses operators
D. Unary operators

View Answer


20.Uncaught exception will call which function?

A. Terminate
B. Catch
C. None of the above
D. Throw

View Answer



Discussion

* You must be logged in to add comment.