LearnFrenzy
Sign in Take a free test

Functions and Default Arguments · Functions MCQ · Question 14

What happens if a noexcept function throws? Answer, explanation & discussion

  • MCQ
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
Question 14 Back to Exercise

What happens if an exception escapes a function declared noexcept?

  • A The exception propagates normally
  • B std::terminate is called and the program ends Correct
  • C The exception is silently ignored
  • D Compilation fails
Correct Answer: Option B

noexcept is a promise; breaking it terminates the program. In exchange, callers and containers can skip exception handling for such calls.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links