Exception Handling In C Plus Plus - Study Mode

[#1] Which of the following statements is true about the 'finally' block in C++ exception handling?
Correct Answer

(C) It is executed regardless of whether an exception is thrown or not

[#2] What is the purpose of re-throwing an exception in C++?
Correct Answer

(A) To handle the exception at a different location

[#3] Which header file is necessary for exception handling in C++?
Correct Answer

(A) <exception>

[#4] What is the function of the 'assert' macro in C++?
Correct Answer

(A) It throws an exception if a condition is false

[#5] How do you define your own exception class in C++?
Correct Answer

(A) class MyException : public std::exception