ExamVeda
Login
Home
Standard Template Library (STL) in C plus plus
?

What is the use of <exception> header

Answer & Solution
Correct Answer: Option A
The <exception> header in C++ is specifically designed to handle errors and unusual situations that occur during the execution of a program.
It defines a hierarchy of standard exception classes, such as std::exception, std::bad_alloc, std::runtime_error, and others.
These classes are used to represent different types of errors and provide a way to report and handle them gracefully.
Option B is incorrect because <exception> doesn't contain all standard library files.
Option C is partially correct, as exceptions can be raised, but <exception> primarily *defines* the exception classes, not directly raise them (though you can throw instances of these classes).
Option D is incorrect because <exception> has nothing to do with reducing memory size. Its purpose is for error handling.
Examveda
Question posted by Examveda
Community

Join the Discussion

1 Comment
Gopal Ambore
Gopal Ambore 11 months ago
The answer to question should be B) contains the standard library files