Which of the following is true about exception handling in C++?
1) There is a standard exception class like Exception class in Java.
2) All exceptions are unchecked in C++, i.e., compiler doesn’t check if the exceptions are caught or not.
3) In C++, a function can specify the list of exceptions that it can throw using comma separated list like following.
void fun(int a, char b) throw (Exception1, Exception2, ..)
(A) 1 and 3
(B) 1, 2 and 3
(C) 1 and 2
(D) 2 and 3
Answer: (B)
Explanation: See Comparison of Exception Handling in C++ and Java
Quiz of this Question
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
Recommended Posts:
- C++ | Exception Handling | Question 9
- C++ | Exception Handling | Question 7
- C++ | Exception Handling | Question 6
- C++ | Exception Handling | Question 1
- C++ | Exception Handling | Question 5
- C++ | Exception Handling | Question 4
- C++ | Exception Handling | Question 2
- C++ | Exception Handling | Question 3
- C++ | Exception Handling | Question 8
- C++ | Exception Handling | Question 12
- C++ | Exception Handling | Question 11
- Java | Exception Handling | Question 8
- Java | Exception Handling | Question 3
- Java | Exception Handling | Question 4
- Java | Exception Handling | Question 2
- Java | Exception Handling | Question 8
- Java | Exception Handling | Question 1
- Java | Exception Handling | Question 7
- Java | Exception Handling | Question 6
- Exception Handling in C++

