Database transactions and ACID exam review

Review key concepts of database transactions and the ACID properties essential for maintaining data integrity in relational databases.

Mighty50·32 flashcards·32 questions
collegecomputer_sciencedatabases
0
Known
1 / 32
0
Learning
Front

What is a database transaction?

Tap to flip
Back

A sequence of operations performed as a single logical unit of work. It ensures data integrity and consistency.

Tap to flip
Got it
Still learning

Quiz(32 questions)

Question 1 of 32

1. What is the primary purpose of a database transaction?

Terms in this Study Set(32)

Database Transactions(16)

What is a database transaction?

A sequence of operations performed as a single logical unit of work. It ensures data integrity and consistency.

True or False: Transactions can partially complete.

False: Transactions must fully complete or not at all, maintaining atomicity.

Fill in the blank: Transactions are essential for _____ in databases.

data integrity.

Examples of transaction operations?

- Insert - Update - Delete

What are the two types of transactions?

Simple (single operation) and Complex (multiple operations).

Cause → Effect: A transaction fails.

The database rolls back to its previous state, ensuring no partial changes.

Difference between persistent and transient transactions?

Persistent transactions save changes permanently, while transient transactions do not.

What are the main properties of transactions?

Atomicity, Consistency, Isolation, Durability (ACID).

What happens during a rollback?

All operations of the transaction are undone, reverting to the last stable state.

True or False: Transactions can be nested.

True: Transactions can contain other transactions, known as nested transactions.

Short example of a simple transaction.

Transfer $100 from Account A to Account B: 1. Deduct $100 from A. 2. Add $100 to B.

What is a commit in transaction?

The operation that finalizes all changes made during the transaction.

Comparison: Read-only vs. Read-write transactions?

Read-only transactions do not modify data; read-write transactions can modify data.

What does isolation ensure in transactions?

That concurrent transactions do not affect each other's execution.

Fill in the blank: Consistency ensures data _____ before and after a transaction.

remains valid.

What role does locking play in transactions?

Locks prevent other transactions from accessing the same data concurrently, ensuring isolation.

ACID Properties(16)

What does Atomicity mean in ACID?

Atomicity ensures that all operations in a transaction are completed or none at all. It guarantees transactions are indivisible.

Fill in the blank: ACID stands for ___.

Atomicity, Consistency, Isolation, Durability.

True or False: Durability guarantees data is lost after a crash.

False. Durability ensures that once a transaction is committed, it remains so even in case of a failure.

What is Consistency in the context of ACID?

Consistency ensures that a transaction takes the database from one valid state to another, preserving all defined rules and constraints.

Compare Atomicity and Durability.

Atomicity: all or nothing. Durability: committed transactions survive failures.

What is Isolation in ACID properties?

Isolation ensures that transactions do not interfere with each other, maintaining data integrity during concurrent operations.

Cause → Effect: Low Isolation leads to ___ .

Dirty reads, lost updates, or inconsistent data.

What is an example of Durability?

After a bank transaction commits, the changes persist even if the server crashes immediately after.

How does ACID relate to reliability?

ACID properties collectively enhance database reliability and integrity, ensuring robust transaction management.

True or False: Isolation can allow transactions to see each other’s intermediate states.

False. Isolation prevents transactions from seeing each other’s intermediate states, ensuring data integrity.

What happens if Atomicity is compromised?

Partial updates may occur, leading to data inconsistency and potential corruption.

Fill in the blank: A consistent database state means ___ .

All defined rules and constraints are satisfied.

What does a lack of Durability imply?

Data changes may be lost due to system crashes after a transaction is committed.

Compare Consistency and Atomicity.

Consistency: valid state transitions. Atomicity: all-or-nothing transaction execution.

What’s a real-world example of Isolation?

Two ATM transactions occurring simultaneously without affecting each other's account balance.

True or False: Isolation can lead to higher system performance.

True. Proper isolation levels can optimize concurrent access while maintaining data integrity.

Questions in this Study Set(32)

1. What is the primary purpose of a database transaction?

A.To ensure data integrity and consistency
B.To increase the performance of database queries
C.To create backups of the database
D.To allow multiple users to access data simultaneously

2. What does Atomicity ensure in a transaction?

A.All operations are completed or none at all.
B.Data is stored permanently.
C.Transaction performance is optimized.
D.Multiple transactions can be processed simultaneously.

3. True or False: A transaction can be considered successful if only part of it completes.

A.True
B.False
C.It depends on the database system
D.Only for complex transactions

4. Which of the following does ACID NOT stand for?

A.Atomicity
B.Consistency
C.Isolation
D.Data Integrity

5. Fill in the blank: Transactions are crucial for _____ in a database.

A.data backup
B.data integrity
C.data compression
D.data retrieval

6. True or False: Durability implies data is recoverable after a crash.

A.True
B.False
C.Only if backups are made
D.Only for uncommitted transactions

7. Which of the following is NOT a typical operation involved in a transaction?

A.Insert
B.Update
C.Delete
D.Query

8. What does Consistency guarantee in a database?

A.Transactions are executed quickly.
B.The database transitions from one valid state to another.
C.Transactions are isolated from each other.
D.Data is always available.

9. What is a complex transaction?

A.A transaction that involves multiple operations
B.A transaction that only reads data
C.A transaction that cannot be rolled back
D.A transaction that is executed faster than a simple transaction

10. Which of the following best describes Isolation?

A.Transactions can see each other's intermediate states.
B.Transactions are executed one after the other.
C.Transactions do not interfere with each other.
D.Isolation is not important in databases.

11. What occurs when a transaction fails?

A.The database saves the changes
B.The database rolls back to its previous state
C.The transaction is logged for future reference
D.The changes are applied partially

12. What could be a consequence of low Isolation levels?

A.Transactions will be faster.
B.Data integrity may be compromised.
C.More transactions can be processed simultaneously.
D.Data will be more accurate.

13. What distinguishes persistent transactions from transient transactions?

A.Persistent transactions can be rolled back
B.Transient transactions save changes permanently
C.Persistent transactions save changes permanently
D.Transient transactions involve multiple operations

14. What is an example of Durability in database transactions?

A.A transaction is instantly rolled back.
B.A committed transaction survives a server crash.
C.Data is deleted after a transaction.
D.Users can view uncommitted changes.

15. Which of the following is NOT a property of ACID transactions?

A.Atomicity
B.Consistency
C.Isolation
D.Accessibility

16. How does ACID contribute to database reliability?

A.By ensuring only fast transactions.
B.By enhancing data integrity and transaction management.
C.By allowing unlimited simultaneous transactions.
D.By promoting data duplication.

17. During a rollback, what happens to the changes made by a transaction?

A.All changes are permanently saved
B.Changes are logged for later review
C.All operations are undone
D.Only successful operations are kept

18. True or False: Isolation can lead to better performance in a database system.

A.True
B.False
C.Only under heavy load
D.Only if transactions are short

19. True or False: Nested transactions can occur within a main transaction.

A.True
B.False
C.Only in certain database systems
D.Nested transactions are not allowed

20. What happens if Atomicity fails during a transaction?

A.The database is always restored.
B.Partial updates can occur, leading to data inconsistency.
C.All transactions are automatically rolled back.
D.No transactions can occur afterwards.

21. Provide a short example of a transaction.

A.Adding 10 miles to a race log
B.Transferring $100 from Account A to Account B
C.Deleting an email from the inbox
D.Reading a book from the library

22. Fill in the blank: A database is in a consistent state when ___.

A.All data is duplicated.
B.All defined rules and constraints are satisfied.
C.Transactions are processed quickly.
D.No errors occur during transactions.

23. What is the purpose of a commit in a transaction?

A.To cancel all changes
B.To finalize all changes made during the transaction
C.To store changes temporarily
D.To log errors in a transaction

24. What does a lack of Durability imply for transactions?

A.Data is stored in the cloud.
B.Changes may be lost following a system failure.
C.Transactions will run faster.
D.Data can be viewed by multiple users at once.

25. How do read-only transactions differ from read-write transactions?

A.Read-only transactions can modify data
B.Read-write transactions do not modify data
C.Read-only transactions do not modify data, while read-write transactions can
D.There is no difference

26. Compare Consistency and Atomicity: which statement is true?

A.Both ensure data accuracy.
B.Consistency refers to state transitions, Atomicity refers to execution completeness.
C.Atomicity applies only to committed transactions.
D.Consistency is not necessary for transactions.

27. What does isolation ensure in the context of database transactions?

A.Transactions are executed one after another
B.Transactions do not interfere with each other
C.Transactions can be executed by multiple users at the same time
D.Transactions can be aborted without consequences

28. What's a practical scenario demonstrating Isolation?

A.Two bank tellers processing the same withdrawal simultaneously.
B.Two users accessing their accounts at the same time without interference.
C.One user updating data while another reads it.
D.A report being generated while data is being entered.

29. Fill in the blank: Consistency guarantees that data _____ before and after a transaction.

A.is deleted
B.is backed up
C.remains valid
D.is changed

30. True or False: Higher Isolation levels may decrease database performance.

A.True
B.False
C.Only if transactions are long
D.Only in distributed databases

31. What role does locking play in database transactions?

A.Locks prevent changes to the database
B.Locks speed up transaction processing
C.Locks prevent other transactions from accessing the same data concurrently
D.Locks are unnecessary for ACID compliance

32. What is the primary role of Atomicity in ACID properties?

A.Ensures all operations in a transaction are completed or none at all
B.Guarantees data is always consistent after a transaction
C.Permits transactions to read intermediate states of each other
D.Allows transactions to occur simultaneously without isolation

Related Study Sets

Create Your Own Study Set

Upload a PDF, paste your notes, or describe a topic – AI generates flashcards, quizzes and more in seconds.