CSSLP · Question #243
In which of the following levels of exception safety are operations succeeded with full guarantee and fulfill all needs in the presence of exceptional situations?
The correct answer is C. Failure transparency. Failure transparency, also known as the 'no-fail guarantee' or 'strong exception safety', ensures that operations either fully succeed or fail in a way that the system state remains unchanged and the failure is completely masked from the caller.
Question
In which of the following levels of exception safety are operations succeeded with full guarantee and fulfill all needs in the presence of exceptional situations?
Options
- ACommit or rollback semantics
- BMinimal exception safety
- CFailure transparency
- DBasic exception safety
How the community answered
(27 responses)- A4% (1)
- B7% (2)
- C85% (23)
- D4% (1)
Why each option
Failure transparency, also known as the 'no-fail guarantee' or 'strong exception safety', ensures that operations either fully succeed or fail in a way that the system state remains unchanged and the failure is completely masked from the caller.
Commit or rollback semantics describe transactional behavior, which is a mechanism to achieve strong exception safety but is not a level of exception safety itself.
Minimal exception safety, also known as the 'no-leak guarantee', means that no resources are leaked, but the program state might be undefined or changed.
Failure transparency, or strong exception safety, guarantees that if an operation throws an exception, the program state remains exactly as it was before the operation began, or the operation fully completes without any side effects observable by the caller.
Basic exception safety, also known as the 'no-corrupt guarantee', ensures that if an exception occurs, the program remains in a valid, consistent state, but the exact state might be different from the original and resources might not be restored to their initial values.
Concept tested: Exception safety levels - Failure Transparency
Topics
Community Discussion
No community discussion yet for this question.