1Z0-900 · Question #17
Given: If an exception is thrown inside the if block, what effect will it have on the transaction?
The correct answer is C. The transaction will be rolled back. When an exception is thrown inside a transaction, the transaction engine automatically rolls back all changes made during that transaction to preserve data integrity - this is the core principle of ACID (Atomicity). Option A is wrong because a commit only occurs when the…
Question
Given:
If an exception is thrown inside the if block, what effect will it have on the transaction?
Exhibit
Options
- AThe transaction will be committed.
- BThe transaction will be suspended.
- CThe transaction will be rolled back.
How the community answered
(33 responses)- A3% (1)
- B3% (1)
- C94% (31)
Explanation
When an exception is thrown inside a transaction, the transaction engine automatically rolls back all changes made during that transaction to preserve data integrity - this is the core principle of ACID (Atomicity). Option A is wrong because a commit only occurs when the transaction completes successfully without errors; an unhandled exception prevents that. Option B is wrong because suspension implies the transaction is paused and can resume later, which is not what happens with an unhandled exception - the transaction is terminated and undone entirely.
Memory tip: Think of a transaction like writing in pencil on a whiteboard - if something goes wrong (exception), you erase everything you wrote (rollback). You only ink it in permanently (commit) when the whole operation succeeds cleanly.
Topics
Community Discussion
No community discussion yet for this question.
