Computer

Transactions & Concurrency Control MCQs with Answers

What is the primary purpose of a transaction in a database system?
a) To store data
b) To ensure data consistency
c) To improve query performance
d) To manage backup schedules

Answer
b) To ensure data consistency

Which of the following is a key property of transactions in a database system?
a) Atomicity
b) Redundancy
c) Data compression
d) Normalization

Answer
a) Atomicity

What does the “Consistency” property of a transaction ensure?
a) A transaction will complete or not complete at all
b) Data will remain in a consistent state before and after the transaction
c) A transaction will be isolated from others
d) A transaction will execute without any errors

Answer
b) Data will remain in a consistent state before and after the transaction

What is the “Isolation” property of a transaction?
a) It ensures a transaction is independent of other concurrent transactions
b) It ensures a transaction is always in a consistent state
c) It ensures a transaction will be logged
d) It ensures a transaction will be committed only if it succeeds

Answer
a) It ensures a transaction is independent of other concurrent transactions

Which of the following is a consequence of violating the “Durability” property of a transaction?
a) Data can be modified by other transactions
b) A transaction’s changes may be lost after a system failure
c) Data consistency is compromised
d) Transactions cannot be rolled back

Answer
b) A transaction’s changes may be lost after a system failure

Which isolation level provides the highest level of concurrency control?
a) Serializable
b) Read Uncommitted
c) Repeatable Read
d) Read Committed

Answer
b) Read Uncommitted

Which of the following is an example of concurrency control in a database?
a) Indexing
b) Locking mechanisms
c) Data normalization
d) Query optimization

Answer
b) Locking mechanisms

What is the primary purpose of locking in a database?
a) To improve query performance
b) To prevent multiple transactions from modifying the same data simultaneously
c) To backup data during transactions
d) To increase the database size

Answer
b) To prevent multiple transactions from modifying the same data simultaneously

Which of the following types of locks allows multiple transactions to read data but prevents any transaction from modifying it?
a) Shared lock
b) Exclusive lock
c) Read lock
d) Write lock

Answer
a) Shared lock

Which concurrency issue occurs when two transactions are executed concurrently and both access the same data item?
a) Dirty read
b) Lost update
c) Non-repeatable read
d) Phantom read

Answer
b) Lost update

Which type of concurrency control guarantees that no transaction can interfere with the operations of another transaction?
a) Lock-based control
b) Optimistic control
c) Timestamp-based control
d) Two-phase locking

Answer
d) Two-phase locking

What is the purpose of the “READ COMMITTED” isolation level?
a) To allow dirty reads
b) To ensure data consistency without locking data
c) To prevent non-repeatable reads
d) To ensure that only committed data is read

Answer
d) To ensure that only committed data is read

Which of the following is an advantage of using the “Serializable” isolation level?
a) High concurrency
b) Maximum isolation of transactions
c) Faster transaction processing
d) Minimal locking overhead

Answer
b) Maximum isolation of transactions

What is a “dirty read” in the context of database transactions?
a) A transaction reading data that has not been committed yet
b) A transaction reading data that has already been committed
c) A transaction writing data to the database
d) A transaction that fails to execute properly

Answer
a) A transaction reading data that has not been committed yet

Which of the following is a disadvantage of the “Repeatable Read” isolation level?
a) It allows dirty reads
b) It results in lower concurrency
c) It guarantees no lost updates
d) It prevents phantom reads

Answer
b) It results in lower concurrency

Which of the following is an effect of a non-repeatable read?
a) A transaction reads the same data multiple times and gets different results
b) A transaction reads data that is never updated
c) A transaction reads the same data multiple times without any issue
d) A transaction cannot access any data until it is fully committed

Answer
a) A transaction reads the same data multiple times and gets different results

What is the role of “two-phase locking” in concurrency control?
a) To ensure that transactions are not executed concurrently
b) To ensure transactions are isolated by acquiring locks before and releasing them after
c) To reduce the complexity of database transactions
d) To prevent transactions from being rolled back

Answer
b) To ensure transactions are isolated by acquiring locks before and releasing them after

Which of the following is true for the “Read Uncommitted” isolation level?
a) It prevents dirty reads
b) It allows dirty reads
c) It prevents non-repeatable reads
d) It guarantees transaction isolation

Answer
b) It allows dirty reads

Which concurrency problem occurs when a transaction reads the same data multiple times and gets different results?
a) Lost update
b) Dirty read
c) Non-repeatable read
d) Phantom read

Answer
c) Non-repeatable read

Which of the following is a property of the “Optimistic Concurrency Control” technique?
a) It assumes no conflict will occur during transaction execution
b) It locks data to prevent other transactions from accessing it
c) It prevents any data changes until all transactions are completed
d) It uses timestamps to maintain transaction order

Answer
a) It assumes no conflict will occur during transaction execution

What is the main disadvantage of the “Read Uncommitted” isolation level?
a) High concurrency
b) Allows dirty reads
c) Lower performance
d) Restricts data modifications

Answer
b) Allows dirty reads

Which of the following is the main objective of concurrency control in databases?
a) To allow transactions to access the same data concurrently without affecting correctness
b) To speed up transaction processing
c) To minimize the use of indexes
d) To reduce the storage requirements of the database

Answer
a) To allow transactions to access the same data concurrently without affecting correctness

What happens in a “phantom read” situation?
a) A transaction reads data that has not yet been committed
b) A transaction reads new rows inserted by other transactions after the initial read
c) A transaction reads the same data multiple times and gets different results
d) A transaction reads the same data multiple times without any issues

Answer
b) A transaction reads new rows inserted by other transactions after the initial read

Which of the following is an advantage of “Serializable” isolation level?
a) High performance
b) Low concurrency
c) Prevents both dirty reads and non-repeatable reads
d) Minimizes lock contention

Answer
c) Prevents both dirty reads and non-repeatable reads

Which of the following isolation levels provides the least strict control over concurrent transactions?
a) Read Committed
b) Repeatable Read
c) Serializable
d) Read Uncommitted

Answer
d) Read Uncommitted

What does the term “ACID” stand for in the context of transactions?
a) Atomicity, Consistency, Isolation, Durability
b) Access Control, Integration, Duplication, Serialization
c) Accuracy, Consistency, Integrity, Durability
d) Atomicity, Compression, Isolation, Duplication

Answer
a) Atomicity, Consistency, Isolation, Durability

Which of the following is NOT part of a transaction’s ACID properties?
a) Durability
b) Isolation
c) Normalization
d) Consistency

Answer
c) Normalization

Which concurrency issue can be avoided by using “two-phase locking”?
a) Dirty read
b) Non-repeatable read
c) Lost update
d) Phantom read

Answer
c) Lost update

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button