Questions: Database Transactions

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A banking application runs two UPDATE statements to transfer money: first debiting Alice's account, then crediting Bob's. There is no explicit transaction — the database is in auto-commit mode. A server crash occurs between the two statements. What is the outcome?

ABoth statements are rolled back automatically because the operation was incomplete
BAlice's account is debited but Bob's is never credited — the $100 is lost
CThe database retries both statements when the server restarts
DThe credit to Bob is applied when the server restarts, completing the transfer
Question 2 Multiple Choice

A developer wraps two UPDATE statements in a transaction with BEGIN, but the application crashes before the COMMIT is issued. What does the database do?

ACommits the changes that completed successfully before the crash
BLeaves the database in a partial state until the developer manually cleans it up
CAutomatically rolls back all changes made since BEGIN, restoring the original state
DCommits the changes on the next successful connection to the database
Question 3 True / False

Issuing ROLLBACK inside a transaction undoes all changes made since the corresponding BEGIN.

TTrue
FFalse
Question 4 True / False

In most relational databases, a ROLLBACK issued inside a transaction will undo a CREATE TABLE or DROP TABLE statement that was executed within that transaction.

TTrue
FFalse
Question 5 Short Answer

What specific problem does transaction atomicity solve, and what is the concrete consequence of running multi-step database operations without it?

Think about your answer, then reveal below.