Exception Handling

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






Also check :


Discussion


* You must be logged in to add comment.