21. What happens if an exception is thrown inside a 'catch' block in C++? A. The exception is automatically caught and handled B. The program continues normally C. The program terminates unexpectedly D. It leads to an infinite loop 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
22. How do you re-throw the current exception in C++? A. throw B. throw e C. rethrow D. throw e.what() 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
23. Which of the following statements about exception handling in C++ is correct? A. It is an alternative to error codes B. It is faster and more efficient than error codes C. It is used only for compile-time errors D. It cannot handle runtime 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
24. What is the purpose of the 'std::exception_ptr' class in C++ exception handling? A. It represents a pointer to an exception object B. It represents a pointer to the exception handler C. It represents a pointer to the exception stack D. It represents a pointer to the exception 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
25. How do you catch multiple exceptions of different types in C++? A. Using multiple catch blocks B. Using a single catch block with multiple exception types C. Using the 'catch (...) ' block D. Using nested catch blocks 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
26. Which keyword is used to define a custom exception class in C++? A. exception B. custom_exception C. throw_exception D. class 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
27. What is the purpose of the 'std::terminate' function in C++? A. It is called when an exception is thrown B. It is called when a program terminates normally C. It is called when an exception is caught D. It is called when an uncaught exception causes program termination 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
28. What is the purpose of the 'nothrow' parameter in the 'new' operator in C++? A. It prevents the 'new' operator from throwing exceptions B. It forces the 'new' operator to throw exceptions C. It specifies the size of the allocated memory D. It specifies the alignment of the allocated memory 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
29. How do you handle exceptions thrown from constructor initialization lists in C++? A. Using try-catch blocks inside the constructor B. Using try-catch blocks outside the constructor C. Using the 'noexcept' specifier D. Exceptions from constructor initialization lists cannot be caught 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
30. What is the purpose of the 'std::bad_function_call' class in C++ exception handling? A. It represents errors in function calls B. It represents errors in lambda expressions C. It represents errors in function pointers D. It represents errors in function templates 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