Successfully reported this slideshow.
www.fellowbuddy.com
Simplifying Students Life
Exception Handling
1. An exception is thrown using _____________ keyword in ...
www.fellowbuddy.com
Simplifying Students Life
6. A try block can be nested under another try block –
a. Yes
b. No
7. In ne...
www.fellowbuddy.com
Simplifying Students Life
a. Compiler executes only executable statements of main()
b. Compiler issues...
www.fellowbuddy.com
Simplifying Students Life
19. Attempting to throw an exception that is not supported by a function cal...
www.fellowbuddy.com
Simplifying Students Life
10. ANSWER: a. True
11. ANSWER: c. catch(…)
12. ANSWER: d. Program will be t...
Upcoming SlideShare
Loading in …5
×

Exception handling www.fellowbuddy.com

113 views

Published on

FellowBuddy.com is a platform which has been setup with a simple vision, keeping in mind the dynamic requirements of students.
Our Vision & Mission - Simplifying Students Life
Our Belief - “The great breakthrough in your life comes when you realize it, that you can learn anything you need to learn; to accomplish any goal that you have set for yourself. This means there are no limits on what you can be, have or do.”

Like Us - https://www.facebook.com/FellowBuddycom-446240585585480

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Exception handling www.fellowbuddy.com

  1. 1. www.fellowbuddy.com Simplifying Students Life Exception Handling 1. An exception is thrown using _____________ keyword in CPP. a. throws b. throw c. threw d. thrown 2. The code of statements which may cause abnormal termination of the program should be written under_________ block a. try b. catch c. Finally d. None of these 3. Exception handlers are declared with ____________ keyword a. Try b. catch c. throw d. finally 4. Catch handler can have multiple parameters. a. True b. False 5. Which of the following statements are true about Catch handler ? 1. It must be placed immediately after try block T 2. It can have multiple parameters 3. There must be only one catch handler for every try block 4. There can be multiple catch handler for a try block T 5. Generic catch handler can be placed anywhere after try block. a. Only 1, 4, 5 b. Only 1, 2, 3 c. Only 1, 4 d. Only 1, 2
  2. 2. www.fellowbuddy.com Simplifying Students Life 6. A try block can be nested under another try block – a. Yes b. No 7. In nested try blocks, there is no need to specify catch handler for inner try block. Outer catch handler is sufficient for the program. a. True b. False 8. 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() 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 these 10. Generic catch handler must be placed at the end of all the catch handlers a. True b. False 11. Generic catch handler is represented by ______________ a. catch(..,) b. catch(---) c. catch(…) d. catch( void x) 12. In nested try blocks, if both inner and outer catch handlers are not able to handle the exception, then______________
  3. 3. www.fellowbuddy.com Simplifying Students Life a. Compiler executes only executable statements of main() b. Compiler issues compile time errors about it c. Program will be executed without any interrupt d. Program will be terminated abnormally 13. Functions called from within a try block may also throw exception a. True b. False 14. Irrespective of exception occurrence, catch handler will always get executed. a. True b. False 15. Throwing an unhandled exception causes standard library function _______________ to be invoked. a. stop() b. aborted() c. terminate() d. abandon() 16. An exception can be of only built-In type. a. True b. False 17. We can prevent a function from throwing any exceptions. a. True b. False 18. How can we restrict a function to throw certain exceptions? a. Defining multiple try and catch block inside a function b. Defining generic function within try block c. Defining function with throw clause d. It is not possible in CPP to restrict a function
  4. 4. www.fellowbuddy.com Simplifying Students Life 19. Attempting to throw an exception that is not supported by a function call results in calling _____________ library function. a. indeterminate() b. unutilized() c. unexpected() d. unpredicted() 20. Return type of uncaught_exception() is________________ a. int b. bool c. char * d. double 21. Can we write throw clause inside catch handler? a. Yes b. No 22. Can we define our exceptions in CPP? a. Yes b. No Answers 1. ANSWER: b. throw 2. ANSWER: a. try 3. ANSWER: b. catch 4. ANSWER: b. False Explanation: A catch handler should contain only one parameter of any type. Multiple parameters are not allowed inside catch handler. 5. ANSWER: c. Only 1, 4 6. ANSWER: a. Yes 7. ANSWER: b. False Explanation: For every try block, there must be at least one catch hander. Otherwise, compiler will generate error. 8. ANSWER: d. Compiler will execute remaining executable statements of outer try block and then the main() 9. ANSWER: c. Compiler will check for appropriate catch handler of outer try block
  5. 5. www.fellowbuddy.com Simplifying Students Life 10. ANSWER: a. True 11. ANSWER: c. catch(…) 12. ANSWER: d. Program will be terminated abnormally 13. ANSWER: a. True 14. ANSWER: b. False Explanation: catch handler will only get execute when exception occurs at runtime 15. ANSWER: c. terminate() 16. ANSWER: b. False Explanation:: An exception can be of any type, including class type that we create. 17. ANSWER: a. True 18. ANSWER: c. Defining function with throw clause 19. ANSWER: c. unexpected() 20. ANSWER: b. bool 21. ANSWER: a. Yes Explanation: In case of re-throwing an exception, we can use throw clause in a catch handler. 22. ANSWER: a. Yes Explanation : We can define our own exception by inheriting and overriding exception class functionality.

×