🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Exception Handling in C++: all 10 questions

Quiz: Exception Handling in C++ · Question 8 of 10

Inside a catch block, what is the difference between throw; and throw e; (where e is const exception &)?

Inside a catch block, what is the difference between throw; and throw e; (where e is const exception &)?

  1. A.There is no difference
  2. B.throw; rethrows the original object with its real type; throw e; throws a new copy of type exception
  3. C.throw e; is faster
  4. D.throw; ends the program
Answer & explanation

Correct answer: throw; rethrows the original object with its real type; throw e; throws a new copy of type exception

Copying through the base-class reference slices the object, so callers catching the derived type miss it.

Can you get the rest right without peeking?

Take the timed Quiz: Exception Handling in C++ quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →