11. Which of the following statements is true about the 'finally' block in C++ exception handling? A. It must be present after every 'try' block B. It is executed if an exception is caught C. It is executed regardless of whether an exception is thrown or not D. It is optional and is not required Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
12. What is the purpose of re-throwing an exception in C++? A. To handle the exception at a different location B. To ignore the exception C. To propagate the exception up the call stack D. To handle the exception at the same location Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
13. Which header file is necessary for exception handling in C++? A. <exception> B. <error> C. <assert> D. <throw> Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
14. What is the function of the 'assert' macro in C++? A. It throws an exception if a condition is false B. It catches exceptions C. It handles arithmetic errors D. It ensures proper memory allocation Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
15. How do you define your own exception class in C++? A. class MyException : public std::exception B. class MyException extends Exception C. class MyException extends Throwable D. class MyException : exception Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
16. What is the default behavior of an uncaught exception in C++? A. It leads to undefined behavior B. It causes the program to crash C. It is automatically caught and handled D. It is logged to a file Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
17. What is the purpose of the 'std::runtime_error' class in C++ exception handling? A. It represents errors detected during runtime B. It represents errors detected during compile time C. It represents logical errors in the code D. It represents memory allocation errors Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
18. How do you specify that a function may throw an exception in C++? A. Using the 'throws' keyword B. Using the 'exception' keyword C. Using the 'throws()' specifier D. Using the 'noexcept' specifier Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
19. Which of the following is true about the 'noexcept' specifier in C++? A. It indicates that a function may throw an exception B. It indicates that a function will never throw an exception C. It automatically catches exceptions D. It is used for exception handling Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
20. What is the purpose of the 'std::bad_alloc' class in C++ exception handling? A. It represents errors related to dynamic memory allocation B. It represents errors related to file handling C. It represents errors related to string manipulation D. It represents errors related to type conversion Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board