What is the advantage of exception handling ?
- Remove error-handling code from the software’s main line of code.
- A method writer can chose to handle certain exceptions and delegate others to the caller.
- An exception that occurs in a function can be handled anywhere in the function call stack.
(A) Only 1
(B) 1, 2 and 3
(C) 1 and 3
(D) 1 and 2
Answer: (B)
Explanation: Advantage of exception handling are :-
- Remove error-handling code from the software’s main line of code.
- A method writer can chose to handle certain exceptions and delegate others to the caller.
- An exception that occurs in a function can be handled anywhere in the function call stack.
- Separating Error-Handling Code from “Regular” Code.
- Propagating Errors Up the Call Stack.
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 10
- 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
- Ruby | Exception handling
Improved By : vivekkumarmth0077

