31. Which statement about the 'finally' block in C++ exception handling is true? A. It must always be followed by a 'catch' block B. It must always be followed by a 'try' block C. It is executed regardless of whether an exception is thrown or not D. It is optional and can be omitted 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
32. What is the purpose of the 'std::nested_exception' class in C++ exception handling? A. It represents exceptions nested within other exceptions B. It represents exceptions thrown by nested functions C. It represents exceptions caught by nested try-catch blocks D. It represents exceptions that occur in nested loops 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
33. How do you catch an exception by reference in C++? A. Using a catch block with an ampersand (&) after the exception type B. Using a catch block with an asterisk (*) after the exception type C. Using a catch block with no specifier after the exception type D. Using a catch block with a 'ref' keyword after the exception type 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
34. What is the purpose of the 'std::logic_error' class in C++ exception handling? A. It represents errors in logical operations B. It represents errors in runtime logic C. It represents errors in memory operations D. It represents errors in arithmetic operations 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
35. What happens if an exception is thrown inside a destructor in C++? A. It leads to undefined behavior B. It is automatically caught and handled C. It causes the program to crash D. It is logged to a file 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
36. Which keyword is used to specify that a function will not throw any exceptions in C++? A. nothrow B. noexcept C. exception D. noexception 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
37. What is the purpose of the 'std::uncaught_exception' function in C++? A. It checks if there are any uncaught exceptions B. It handles uncaught exceptions C. It throws an exception D. It catches an 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
38. Which standard header file is required for exception handling in C++? A. <stdexcept> B. <exception> C. <error> D. <assert> 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
39. How do you specify that a function will throw no exceptions in C++? A. Using the 'noexcept' specifier B. Using the 'nothrow' specifier C. Using the 'throw' keyword D. Using the 'catch' block 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
40. What is the purpose of the 'std::exception_ptr::rethrow' function in C++? A. It rethrows the current exception B. It creates a new exception C. It catches an exception D. It checks for exceptions 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