Open In App
Related Articles

C++ | Exception Handling | Question 2

Improve Article
Improve
Save Article
Save
Like Article
Like

What is the advantage of exception handling ?

  1. Remove error-handling code from the software’s main line of code.
  2. A method writer can choose to handle certain exceptions and delegate others to the caller.
  3. 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 :-

  1. Remove error-handling code from the software’s main line of code.
  2. A method writer can choose to handle certain exceptions and delegate others to the caller.
  3. An exception that occurs in a function can be handled anywhere in the function call stack.
  4. Separating Error-Handling Code from “Regular” Code.
  5. Propagating Errors Up the Call Stack.


Quiz of this Question

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 22 Sep, 2021
Like Article
Save Article
Similar Reads