LearnFrenzy
Sign in Take a free test

Error Handling · Error Handling MCQ · Question 7

In what order do atexit handlers run? Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 7 Back to Exercise

A program registers atexit(a) and then atexit(b). In what order do they run at exit?

  • A a then b
  • B b then a Correct
  • C Only b
  • D In an unspecified order
Correct Answer: Option B

Handlers run in reverse order of registration, like a stack – so things set up later are torn down first.

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