7.4 Transaction processing, concurrency control and crash recovery
TRANSACTION PROCESSING, CONCURRENCY CONTROL and CRASH RECOVERY:
ACID properties
What are the ACID properties in the context of database transactions?
a) Atomicity, Consistency, Isolation, Durability
b) Aggregation, Consistency, Integrity, Durability
c) Atomicity, Clarity, Isolation, Durability
d) Accuracy, Consistency, Isolation, Durability
Answer: a) Atomicity, Consistency, Isolation, Durability
Explanation: ACID stands for Atomicity, Consistency, Isolation, and Durability, which are fundamental properties that ensure reliability and integrity of database transactions.
Which ACID property ensures that either all operations in a transaction are completed successfully or none of them are?
a) Atomicity
b) Consistency
c) Isolation
d) Durability
Answer: a) Atomicity
Explanation: Atomicity ensures that a transaction is treated as a single unit, and either all of its operations are completed successfully (committed) or none of them are (rolled back).
Which ACID property ensures that transactions preserve the integrity constraints and invariants of the database?
a) Atomicity
b) Consistency
c) Isolation
d) Durability
Answer: b) Consistency
Explanation: Consistency ensures that transactions preserve the consistency of the database, meaning that it transitions from one consistent state to another consistent state after a transaction is executed.
Which ACID property ensures that transactions are executed independently of each other?
a) Atomicity
b) Consistency
c) Isolation
d) Durability
Answer: c) Isolation
Explanation: Isolation ensures that the execution of one transaction does not interfere with the execution of other transactions, maintaining data integrity and preventing concurrency-related issues like dirty reads and lost updates.
Which ACID property ensures that committed changes to the database are permanent, even in the event of a system failure?
a) Atomicity
b) Consistency
c) Isolation
d) Durability
Answer: d) Durability
Explanation: Durability ensures that once a transaction is committed and changes are made to the database, they are permanent and will not be lost, even in the event of a system failure or crash.
What does atomicity guarantee in a database transaction?
a) Consistency of the database
b) Isolation of transactions
c) All-or-nothing execution of transactions
d) Permanent storage of committed changes
Answer: c) All-or-nothing execution of transactions
Explanation: Atomicity guarantees that either all operations within a transaction are executed successfully or none of them are, ensuring that transactions are treated as indivisible units of work.
In the ACID properties, what does consistency refer to?
a) Ensuring all transactions are executed independently
b) Ensuring transactions preserve database integrity constraints
c) Ensuring transactions are executed in isolation
d) Ensuring committed changes are permanent
Answer: b) Ensuring transactions preserve database integrity constraints
Explanation: Consistency ensures that transactions preserve the integrity constraints and invariants of the database, maintaining its consistency after transaction execution.
What does isolation ensure in the ACID properties?
a) Committed changes are permanent
b) Transactions are executed independently
c) All-or-nothing execution of transactions
d) Transactions preserve database integrity constraints
Answer: b) Transactions are executed independently
Explanation: Isolation ensures that transactions are executed independently of each other, preventing interference and concurrency-related issues such as dirty reads and lost updates.
Which ACID property ensures that changes made by committed transactions are durable?
a) Atomicity
b) Consistency
c) Isolation
d) Durability
Answer: d) Durability
Explanation: Durability ensures that changes made by committed transactions are durable and will persist even in the event of system failures or crashes.
If a database system guarantees the ACID properties, what can be inferred about its transaction management?
a) Transactions are executed in parallel
b) Transactions are executed sequentially
c) Transactions are executed independently
d) Transactions are not supported
Answer: c) Transactions are executed independently
Explanation: If a database system guarantees the ACID properties, it means that transactions are executed independently, preserving data integrity and ensuring reliable transaction management.
CONCURRENT EXECUTION
What is concurrent execution in the context of a database system?
a) Execution of multiple transactions simultaneously
b) Sequential execution of transactions
c) Execution of transactions with external systems
d) Execution of transactions in isolation
Answer: a) Execution of multiple transactions simultaneously
Explanation: Concurrent execution refers to the simultaneous execution of multiple transactions in a database system, allowing for improved throughput and resource utilization.
Which of the following is a benefit of concurrent execution in a database system?
a) Reduced data consistency
b) Improved transaction isolation
c) Decreased system throughput
d) Increased transaction latency
Answer: b) Improved transaction isolation
Explanation: Concurrent execution allows for improved transaction isolation, enabling transactions to execute independently of each other and reducing contention for shared resources.
What is a transaction in the context of concurrent execution?
a) A unit of work that must be executed sequentially
b) A request to access a database system
c) A set of operations that must be executed atomically
d) A unit of work that may be executed concurrently with other transactions
Answer: d) A unit of work that may be executed concurrently with other transactions
Explanation: A transaction is a unit of work that may consist of one or more operations and can be executed concurrently with other transactions in a database system.
What is concurrency control in a database system?
a) The process of executing transactions sequentially
b) The process of ensuring data consistency during concurrent execution
c) The process of executing transactions in parallel
d) The process of managing access to shared resources to prevent conflicts during concurrent execution
Answer: d) The process of managing access to shared resources to prevent conflicts during concurrent execution
Explanation: Concurrency control involves managing access to shared resources such as database objects to prevent conflicts and ensure data consistency during concurrent execution of transactions.
What is a critical section in the context of concurrent execution?
a) A section of code that must be executed sequentially
b) A section of code that may be executed concurrently with other sections
c) A section of code that accesses shared resources and requires synchronization
d) A section of code that accesses local variables only
Answer: c) A section of code that accesses shared resources and requires synchronization
Explanation: A critical section is a section of code that accesses shared resources such as database objects and requires synchronization to prevent conflicts during concurrent execution.
Which concurrency control technique ensures that only one transaction can access a resource at a time?
a) Locking
b) Timestamp ordering
c) Optimistic concurrency control
d) Two-phase locking
Answer: a) Locking
Explanation: Locking is a concurrency control technique that ensures exclusive access to resources by allowing only one transaction to acquire a lock on a resource at a time.
What is a deadlock in the context of concurrent execution?
a) A situation where transactions cannot proceed because they are waiting for resources held by other transactions
b) A situation where transactions execute in parallel without conflicts
c) A situation where transactions are rolled back due to a system failure
d) A situation where transactions commit simultaneously
Answer: a) A situation where transactions cannot proceed because they are waiting for resources held by other transactions
Explanation: A deadlock occurs when two or more transactions are waiting for resources held by each other, resulting in a deadlock where none of the transactions can proceed.
Which of the following is a technique used to prevent deadlocks in a database system?
a) Lock timeout
b) Optimistic concurrency control
c) Two-phase locking
d) Deadlock detection and resolution
Answer: d) Deadlock detection and resolution
Explanation: Deadlock detection and resolution is a technique used to prevent deadlocks by identifying and resolving deadlock situations, such as by aborting one of the transactions involved in the deadlock.
What is a transaction schedule in the context of concurrent execution?
a) A sequence of transactions that are executed in isolation
b) A sequence of transactions that are executed in parallel
c) A sequence of operations within a single transaction
d) A sequence of transactions and their corresponding operations executed by the database system
Answer: d) A sequence of transactions and their corresponding operations executed by the database system
Explanation: A transaction schedule is a sequence of transactions and their corresponding operations executed by the database system, including the order of execution and any interleaving of operations.
Which of the following is an advantage of concurrent execution in a database system?
a) Reduced transaction isolation
b) Increased system complexity
c) Improved system throughput
d) Decreased transaction durability
Answer: c) Improved system throughput
Explanation: Concurrent execution in a database system can improve system throughput by allowing multiple transactions to execute simultaneously, thereby maximizing resource utilization and reducing idle time.
SERIALIZABILITY CONCEPT
What does serializability refer to in the context of database transactions?
a) The ability to execute transactions in parallel
b) The order in which transactions are executed
c) The consistency of database state after transaction execution
d) The property of transactions to produce the same results as if executed serially
Answer: d) The property of transactions to produce the same results as if executed serially
Explanation: Serializability ensures that concurrent execution of transactions yields the same results as if the transactions were executed serially, maintaining data consistency.
Which of the following is a requirement for serializability of transactions?
a) Deadlock avoidance
b) Mutual exclusion
c) Recoverability
d) Conflict serializability
Answer: d) Conflict serializability
Explanation: Conflict serializability ensures that transactions are serializable by avoiding conflicts between concurrent operations on shared resources.
What is a serial schedule in the context of transaction execution?
a) A schedule where transactions are executed sequentially
b) A schedule where transactions are executed in parallel
c) A schedule where transactions are executed with no regard to conflicts
d) A schedule where transactions are executed randomly
Answer: a) A schedule where transactions are executed sequentially
Explanation: A serial schedule is a schedule where transactions are executed sequentially, one after the other, with no overlapping of operations.
Which of the following is a conflict operation in the context of transaction scheduling?
a) Read-Write
b) Read-Read
c) Write-Write
d) Write-Read
Answer: c) Write-Write
Explanation: Write-Write is a conflict operation where one transaction writes to a data item that is also being written to by another transaction, potentially causing data inconsistency.
In a conflict serializable schedule, what is a serializability graph used for?
a) Representing the sequence of transactions in the schedule
b) Identifying conflicts between transactions
c) Determining the order of execution for transactions
d) Verifying the serializability of the schedule
Answer: d) Verifying the serializability of the schedule
Explanation: A serializability graph is used to verify the serializability of a schedule by representing the dependencies between transactions based on conflicting operations.
What is a precedence graph in the context of transaction scheduling?
a) A graph representing the precedence of transactions based on their start and end times
b) A graph representing the precedence of operations within a transaction
c) A graph representing the precedence of transactions based on their conflicting operations
d) A graph representing the precedence of database locks acquired by transactions
Answer: c) A graph representing the precedence of transactions based on their conflicting operations
Explanation: A precedence graph represents the precedence of transactions based on conflicting operations, helping to identify cycles and ensure conflict serializability.
Which of the following is a technique used for conflict resolution in transaction scheduling?
a) Two-phase locking
b) Deadlock detection
c) Timestamp ordering
d) Query optimization
Answer: a) Two-phase locking
Explanation: Two-phase locking is a concurrency control technique used for conflict resolution by ensuring that transactions acquire and release locks in two phases: growing and shrinking.
What is a serializable schedule in the context of transaction execution?
a) A schedule where transactions are executed with no regard to conflicts
b) A schedule where transactions are executed in parallel
c) A schedule where transactions are executed sequentially
d) A schedule where transactions are executed randomly
Answer: c) A schedule where transactions are executed sequentially
Explanation: A serializable schedule is a schedule where transactions are executed sequentially, ensuring conflict serializability and data consistency.
Which of the following is an advantage of serializability in database transactions?
a) Increased system complexity
b) Decreased data consistency
c) Enhanced concurrency
d) Reduced transaction durability
Answer: c) Enhanced concurrency
Explanation: Serializability enhances concurrency by allowing transactions to execute concurrently while preserving data consistency through conflict serializability.
What does the term "conflict" refer to in the context of transaction scheduling?
a) A situation where transactions cannot proceed due to resource contention
b) A situation where transactions execute in parallel without conflicts
c) A situation where transactions violate integrity constraints
d) A situation where transactions perform conflicting operations on shared resources
Answer: d) A situation where transactions perform conflicting operations on shared resources
Explanation: In transaction scheduling, a conflict occurs when transactions perform conflicting operations on shared resources, potentially leading to data inconsistency if not managed properly.
LOCK BASED PROTOCOLS
What is the primary purpose of lock-based protocols in database management systems?
a) To ensure transactions are executed in parallel
b) To prevent deadlock situations
c) To manage concurrent access to shared resources
d) To enforce data consistency constraints
Answer: c) To manage concurrent access to shared resources
Explanation: Lock-based protocols are used to manage concurrent access to shared resources such as database objects by allowing transactions to acquire and release locks.
In lock-based concurrency control, what is a lock?
a) A mechanism used to synchronize transactions
b) A mechanism used to ensure transaction isolation
c) A mechanism used to prevent transactions from accessing data
d) A mechanism used to control access to shared resources
Answer: d) A mechanism used to control access to shared resources
Explanation: A lock is a mechanism used to control access to shared resources, ensuring that transactions can access data in a mutually exclusive manner.
Which type of lock allows multiple transactions to read a resource simultaneously but requires exclusive access for writing?
a) Shared lock
b) Exclusive lock
c) Read lock
d) Write lock
Answer: a) Shared lock
Explanation: A shared lock allows multiple transactions to read a resource simultaneously, ensuring that no transaction can modify the resource until all shared locks are released.
What is a deadlock in the context of lock-based protocols?
a) A situation where transactions cannot proceed due to resource contention
b) A situation where transactions execute in parallel without conflicts
c) A situation where transactions violate integrity constraints
d) A situation where transactions are waiting for each other to release locks, causing a cycle of dependencies
Answer: d) A situation where transactions are waiting for each other to release locks, causing a cycle of dependencies
Explanation: A deadlock occurs in lock-based protocols when two or more transactions are waiting for each other to release locks, causing a cycle of dependencies where none of the transactions can proceed.
Which lock-based protocol ensures that transactions acquire all necessary locks before starting execution and release them only after completing execution?
a) Two-phase locking
b) Timestamp ordering
c) Optimistic concurrency control
d) Strict two-phase locking
Answer: a) Two-phase locking
Explanation: Two-phase locking ensures transaction serializability by requiring transactions to acquire all necessary locks before starting execution (the growing phase) and releasing them only after completing execution (the shrinking phase).
What is the purpose of lock compatibility in lock-based protocols?
a) To ensure transactions execute in parallel
b) To prevent deadlock situations
c) To manage conflicts between transactions
d) To enforce data consistency constraints
Answer: c) To manage conflicts between transactions
Explanation: Lock compatibility determines whether a transaction can acquire a lock on a resource based on the locks held by other transactions, helping to manage conflicts and prevent contention.
Which of the following statements about shared locks is true?
a) Shared locks allow multiple transactions to write to a resource simultaneously.
b) Shared locks are incompatible with exclusive locks.
c) Shared locks are typically used for short-duration transactions.
d) Shared locks prevent other transactions from reading the resource.
Answer: b) Shared locks are incompatible with exclusive locks.
Explanation: Shared locks are compatible with other shared locks but are incompatible with exclusive locks, meaning that they prevent transactions from acquiring exclusive access to a resource.
Which lock-based protocol allows transactions to read uncommitted data but prevents dirty reads?
a) Strict two-phase locking
b) Rigorous two-phase locking
c) Two-phase locking with shared locks
d) Two-phase locking with exclusive locks
Answer: a) Strict two-phase locking
Explanation: Strict two-phase locking ensures data consistency by preventing dirty reads, where transactions read uncommitted data, while still allowing concurrent read operations.
What is a shared/exclusive (read/write) lock pair commonly referred to as in lock-based protocols?
a) Shared lock
b) Exclusive lock
c) Binary lock
d) Update lock
Answer: c) Binary lock
Explanation: A shared/exclusive (read/write) lock pair is commonly referred to as a binary lock, as it represents the two possible states of access to a resource: shared (read) or exclusive (write).
In lock-based concurrency control, what is lock granularity?
a) The size of the data items locked by a transaction
b) The number of locks held by a transaction
c) The duration for which locks are held by a transaction
d) The level of compatibility between locks held by different transactions
Answer: a) The size of the data items locked by a transaction
Explanation: Lock granularity refers to the size of the data items locked by a transaction, which can range from fine-grained (small data items) to coarse-grained (large data items), affecting concurrency and contention.
DEADLOCK HANDLING AND PREVENTION
What is a deadlock in the context of database management systems?
a) A situation where transactions are executed sequentially
b) A situation where transactions are executed in parallel without conflicts
c) A situation where transactions are waiting for each other to release locks, causing a cycle of dependencies
d) A situation where transactions cannot proceed due to resource contention
Answer: c) A situation where transactions are waiting for each other to release locks, causing a cycle of dependencies
Explanation: A deadlock occurs when two or more transactions are waiting for each other to release locks, resulting in a cyclic dependency where none of the transactions can proceed.
Which of the following is NOT a condition necessary for deadlock to occur?
a) Mutual exclusion
b) Hold and wait
c) No preemption
d) Circular wait
Answer: a) Mutual exclusion
Explanation: Mutual exclusion is a necessary condition for concurrency control but not for deadlock to occur. The necessary conditions for deadlock are hold and wait, no preemption, and circular wait.
What is hold and wait in the context of deadlock prevention?
a) Transactions hold locks while waiting for other resources
b) Transactions wait for resources without holding any locks
c) Transactions hold resources without waiting for other resources
d) Transactions wait for resources without holding any resources
Answer: a) Transactions hold locks while waiting for other resources
Explanation: Hold and wait is a condition where transactions hold locks on resources while waiting for other resources to become available, potentially leading to deadlock.
Which deadlock prevention technique involves allocating all required resources to a transaction before it begins execution?
a) Wait-die
b) Wound-wait
c) Resource preemption
d) Timeout-based deadlock detection
Answer: c) Resource preemption
Explanation: Resource preemption involves allocating all required resources to a transaction before it begins execution and preempting resources from other transactions if necessary to avoid deadlock.
In deadlock prevention, what is the purpose of wait-die and wound-wait strategies?
a) To prevent transactions from waiting indefinitely
b) To prevent transactions from acquiring locks
c) To prevent transactions from holding locks
d) To prevent transactions from releasing locks
Answer: a) To prevent transactions from waiting indefinitely
Explanation: Wait-die and wound-wait strategies are used to prevent transactions from waiting indefinitely by allowing older transactions (wait-die) or younger transactions (wound-wait) to continue execution.
Which deadlock handling technique involves detecting deadlocks as they occur and breaking the deadlock by aborting one or more transactions?
a) Deadlock prevention
b) Deadlock avoidance
c) Deadlock detection and recovery
d) Deadlock timeout
Answer: c) Deadlock detection and recovery
Explanation: Deadlock detection and recovery involve detecting deadlocks as they occur and breaking the deadlock by aborting one or more transactions involved in the deadlock.
What is deadlock timeout in the context of deadlock handling?
a) A technique to detect deadlocks by setting a timeout for transaction execution
b) A technique to prevent deadlocks by aborting transactions after a predefined timeout period
c) A technique to recover from deadlocks by rolling back transactions after a predefined timeout period
d) A technique to avoid deadlocks by delaying transaction execution until resources become available
Answer: b) A technique to prevent deadlocks by aborting transactions after a predefined timeout period
Explanation: Deadlock timeout is a technique to prevent deadlocks by aborting transactions after a predefined timeout period if they cannot acquire necessary resources.
Which deadlock prevention technique involves ordering resources and requiring transactions to acquire resources in a specific order to prevent circular wait?
a) Resource preemption
b) Timeout-based deadlock detection
c) Wait-die
d) Strict two-phase locking
Answer: d) Strict two-phase locking
Explanation: Strict two-phase locking involves ordering resources and requiring transactions to acquire resources in a specific order to prevent circular wait and avoid deadlock.
Which deadlock handling technique involves designing the database system in such a way that deadlocks cannot occur?
a) Deadlock prevention
b) Deadlock avoidance
c) Deadlock detection and recovery
d) Deadlock timeout
Answer: a) Deadlock prevention
Explanation: Deadlock prevention involves designing the database system in such a way that deadlocks cannot occur by ensuring that at least one of the necessary conditions for deadlock is not satisfied.
What is the main disadvantage of deadlock detection and recovery techniques?
a) Increased system complexity
b) Increased system throughput
c) Decreased system reliability
d) Decreased transaction isolation
Answer: a) Increased system complexity
Explanation: Deadlock detection and recovery techniques add complexity to the database system due to the need for deadlock detection algorithms and mechanisms for transaction rollback or abort.
FAILURE CLASSIFICATION
What is a failure in the context of database management systems?
a) A situation where a transaction executes successfully
b) A situation where a system error or crash prevents normal operation
c) A situation where a deadlock occurs between transactions
d) A situation where data consistency is maintained
Answer: b) A situation where a system error or crash prevents normal operation
Explanation: A failure in DBMS refers to a situation where a system error, hardware malfunction, or crash occurs, preventing the database system from operating normally.
Which of the following is NOT a type of failure in database management systems?
a) Transaction failure
b) System failure
c) Disk failure
d) Network failure
Answer: c) Disk failure
Explanation: Disk failure is typically considered as a hardware failure and is not specifically categorized as a type of failure in database management systems.
What is a transaction failure in DBMS?
a) A failure caused by hardware malfunction
b) A failure caused by a transaction violating integrity constraints
c) A failure caused by a transaction aborting or rolling back
d) A failure caused by a deadlock between transactions
Answer: c) A failure caused by a transaction aborting or rolling back
Explanation: A transaction failure occurs when a transaction cannot be completed successfully and needs to be aborted or rolled back due to reasons such as deadlock, integrity constraint violation, or system error.
Which type of failure in DBMS occurs when the database system crashes or becomes unresponsive?
a) Transaction failure
b) System failure
c) Disk failure
d) Network failure
Answer: b) System failure
Explanation: System failure occurs when the database system crashes, becomes unresponsive, or encounters errors that prevent normal operation.
What is a network failure in the context of database management systems?
a) A failure caused by a transaction violating integrity constraints
b) A failure caused by a transaction aborting or rolling back
c) A failure caused by communication errors between networked components
d) A failure caused by a deadlock between transactions
Answer: c) A failure caused by communication errors between networked components
Explanation: Network failure occurs when there are communication errors or disruptions between networked components, leading to data transmission failures or delays.
Which of the following is an example of a transaction failure?
a) A disk crash leading to data loss
b) A deadlock between two transactions
c) A transaction aborting due to a violation of integrity constraints
d) A network outage disrupting communication between servers
Answer: c) A transaction aborting due to a violation of integrity constraints
Explanation: A transaction failure can occur when a transaction aborts due to reasons such as deadlock, integrity constraint violation, or system error.
What is the primary goal of failure classification in database management systems?
a) To prevent system failures
b) To recover from system crashes
c) To categorize different types of failures for analysis and handling
d) To maximize system throughput
Answer: c) To categorize different types of failures for analysis and handling
Explanation: The primary goal of failure classification is to categorize different types of failures in DBMS for analysis, understanding their causes, and implementing appropriate handling mechanisms.
Which type of failure in DBMS is typically caused by physical damage to storage devices?
a) Transaction failure
b) System failure
c) Disk failure
d) Network failure
Answer: c) Disk failure
Explanation: Disk failure occurs when there is physical damage to storage devices such as hard disk drives (HDDs) or solid-state drives (SSDs), leading to data loss or corruption.
How does failure classification help in database management?
a) By preventing system failures
b) By predicting future failures
c) By providing insights into the causes and effects of failures
d) By eliminating the need for failure recovery mechanisms
Answer: c) By providing insights into the causes and effects of failures
Explanation: Failure classification helps in database management by providing insights into the causes and effects of different types of failures, enabling better understanding, analysis, and implementation of appropriate handling mechanisms.
Which of the following is an example of a system failure in DBMS?
a) Corruption of database records due to disk failure
b) Transaction rollback due to deadlock
c) Unresponsive database server due to memory overflow
d) Communication errors between networked components
Answer: c) Unresponsive database server due to memory overflow
Explanation: A system failure in DBMS can occur due to various reasons such as hardware malfunctions, software errors, or resource exhaustion, leading to system crashes or unresponsiveness.
RECOVERY AND ATOMICITY
What is the concept of atomicity in database transactions?
a) It ensures that transactions execute in parallel.
b) It guarantees that transactions are executed in a sequential order.
c) It ensures that transactions are either completely executed or completely aborted.
d) It guarantees that transactions execute within a fixed time limit.
Answer: c) It ensures that transactions are either completely executed or completely aborted.
Explanation: Atomicity ensures that transactions are indivisible units of work, meaning that either all operations within a transaction are successfully completed, or none of them are.
Which of the following properties of transactions ensures that the effects of committed transactions are permanent?
a) Atomicity
b) Consistency
c) Isolation
d) Durability
Answer: d) Durability
Explanation: Durability ensures that the effects of committed transactions are permanent and survive system failures, crashes, or restarts.
In the context of transaction recovery, what is a write-ahead logging (WAL) protocol?
a) A protocol that records all data modifications before they are applied to the database.
b) A protocol that ensures transactions execute in parallel.
c) A protocol that guarantees serializability of transactions.
d) A protocol that defines the order of transaction operations.
Answer: a) A protocol that records all data modifications before they are applied to the database.
Explanation: The write-ahead logging (WAL) protocol records all data modifications in a log file before they are applied to the database, ensuring that changes can be replayed in case of failure.
What is a transaction log in the context of recovery in DBMS?
a) A log file that records all transactions executed by the database system.
b) A log file that records only committed transactions.
c) A log file that records only aborted transactions.
d) A log file that records system errors and crashes.
Answer: a) A log file that records all transactions executed by the database system.
Explanation: A transaction log is a file maintained by the DBMS that records all transactions executed by the system, including their operations and changes made to the database.
Which recovery technique involves undoing the effects of transactions that were not committed at the time of system failure?
a) Redo
b) Rollback
c) Undo
d) Checkpoint
Answer: b) Rollback
Explanation: Rollback is a recovery technique that involves undoing the effects of transactions that were not committed at the time of system failure, restoring the database to its previous consistent state.
What is the purpose of a checkpoint in transaction recovery?
a) To ensure that all transactions are committed simultaneously.
b) To ensure that transaction logs are periodically flushed to disk.
c) To record the state of the database at a specific point in time.
d) To prevent transactions from acquiring locks.
Answer: c) To record the state of the database at a specific point in time.
Explanation: A checkpoint is a point in time at which the DBMS records the state of the database, including all committed transactions and their corresponding changes, in the transaction log.
Which recovery technique involves reapplying the effects of committed transactions from the transaction log to the database after a system failure?
a) Redo
b) Rollback
c) Undo
d) Checkpoint
Answer: a) Redo
Explanation: Redo is a recovery technique that involves reapplying the effects of committed transactions from the transaction log to the database after a system failure, ensuring that all committed changes are persistent.
What is the ACID property associated with atomicity in DBMS?
a) Atomicity
b) Consistency
c) Isolation
d) Durability
Answer: a) Atomicity
Explanation: The ACID property associated with atomicity in DBMS ensures that transactions are indivisible units of work, where either all operations within a transaction are successfully completed, or none of them are.
Which of the following actions is NOT a part of the recovery process in DBMS?
a) Redo
b) Rollback
c) Checkpoint
d) Commit
Answer: d) Commit
Explanation: Commit is not part of the recovery process in DBMS; it is a transaction operation that indicates the successful completion of a transaction and its intention to make changes permanent.
What is the primary goal of recovery in database management systems?
a) To ensure that transactions execute in parallel.
b) To prevent system failures.
c) To restore the database to a consistent state after a system failure.
d) To enforce data consistency constraints.
Answer: c) To restore the database to a consistent state after a system failure.
Explanation: The primary goal of recovery in DBMS is to restore the database to a consistent state after a system failure, ensuring that committed transactions are durable and persistent.
LOG-BASED RECOVERY
What is log-based recovery in database management systems?
a) A recovery technique that relies on periodic backups of the database.
b) A recovery technique that uses transaction logs to restore the database to a consistent state after a failure.
c) A recovery technique that relies on checkpoints to track the state of the database.
d) A recovery technique that requires redoing all transactions from the beginning.
Answer: b) A recovery technique that uses transaction logs to restore the database to a consistent state after a failure.
Explanation: Log-based recovery involves using transaction logs, which record all changes made to the database, to restore the database to a consistent state in case of failure.
What is the primary purpose of the transaction log in log-based recovery?
a) To record the state of the database at regular intervals.
b) To track the execution order of transactions.
c) To provide a history of all committed transactions and their changes.
d) To maintain a record of system errors and crashes.
Answer: c) To provide a history of all committed transactions and their changes.
Explanation: The transaction log maintains a record of all committed transactions and their corresponding changes, allowing for recovery in case of failure by redoing or undoing transactions as necessary.
Which of the following actions is recorded in the transaction log during normal transaction processing?
a) Read operations
b) Write operations
c) Checkpoint operations
d) System errors
Answer: b) Write operations
Explanation: Write operations, such as inserts, updates, and deletes, are recorded in the transaction log to ensure that changes made to the database can be recovered in case of failure.
What is the purpose of the undo phase in log-based recovery?
a) To reapply changes made by transactions that were not committed at the time of failure.
b) To restore the database to its previous consistent state by undoing changes made by aborted transactions.
c) To record all changes made by transactions before they are committed.
d) To maintain a record of system checkpoints.
Answer: b) To restore the database to its previous consistent state by undoing changes made by aborted transactions.
Explanation: The undo phase involves undoing changes made by transactions that were not committed at the time of failure, restoring the database to its previous consistent state.
In log-based recovery, what is the purpose of the redo phase?
a) To undo changes made by aborted transactions.
b) To reapply changes made by committed transactions from the transaction log.
c) To record all changes made by transactions before they are committed.
d) To maintain a record of system checkpoints.
Answer: b) To reapply changes made by committed transactions from the transaction log.
Explanation: The redo phase involves reapplying changes made by committed transactions from the transaction log to ensure that all committed changes are persistent.
Which of the following recovery techniques is based on the principle of "write-ahead logging"?
a) Checkpoint-based recovery
b) Redo-based recovery
c) Undo-based recovery
d) Rollback-based recovery
Answer: b) Redo-based recovery
Explanation: Redo-based recovery relies on the "write-ahead logging" principle, where changes are recorded in the transaction log before they are applied to the database, ensuring durability and recoverability.
What is the purpose of the transaction commit record in the transaction log?
a) To indicate the beginning of a transaction.
b) To record changes made by a transaction before it commits.
c) To mark the successful completion of a transaction.
d) To record system checkpoints.
Answer: c) To mark the successful completion of a transaction.
Explanation: The transaction commit record in the transaction log marks the successful completion of a transaction, indicating that all changes made by the transaction are durable and can be committed to the database.
Which of the following recovery techniques involves scanning the transaction log forward from the last checkpoint to determine which transactions need to be redone or undone?
a) Redo-based recovery
b) Undo-based recovery
c) Checkpoint-based recovery
d) Rollback-based recovery
Answer: a) Redo-based recovery
Explanation: Redo-based recovery involves scanning the transaction log forward from the last checkpoint to reapply changes made by committed transactions, ensuring durability and consistency.
What is a transaction rollback record in the transaction log used for?
a) To indicate the beginning of a transaction.
b) To record changes made by a transaction before it commits.
c) To mark the successful completion of a transaction.
d) To undo changes made by an aborted transaction.
Answer: d) To undo changes made by an aborted transaction.
Explanation: A transaction rollback record in the transaction log is used to undo changes made by an aborted transaction, restoring the database to its previous consistent state.
Which recovery technique is efficient for handling failures that occur during system operation without requiring frequent database checkpoints?
a) Redo-based recovery
b) Undo-based recovery
c) Checkpoint-based recovery
d) Rollback-based recovery
Answer: a) Redo-based recovery
Explanation: Redo-based recovery is efficient for handling failures during system operation as it involves reapplying changes made by committed transactions from the transaction log, without the need for frequent database checkpoints.