# Database: Transactions: Quiz

Name __________________________________________

All possible answers are worth one point unless otherwise indicated. Multiple choice questions have only one best answer unless otherwise indicated.

1. Assume a database is read-only, ie, there are no updates, additions, or deletions made to the operational database. Assume also that this database is used concurrently by many users. Which statement best describes the situation with transactions on this database.
   1. Transactions are not necessary.
   2. Transactions may be useful in some situations.
   3. Transactions are necessary.
2. What is the SQL statement that tells the database that all changes in the transaction may now be made.
   1. `SAVE`
   2. `SAVE ALL`
   3. `COMMIT`
   4. `UPDATE`
   5. None of the above.
3. What is the SQL statement that tells the database that no changes in the transaction should be made.
   1. `ABORT`
   2. `EXIT SAVE=FALSE`
   3. `BACKUP`
   4. `ROLLBACK`
   5. `RESTORE`
   6. None of the above.
4. What is a deadlock?
   1. A situation where several transactions are blocked by each other.
   2. A lock that is no longer active.
   3. The "blue screen of death".
   4. A situation where the transaction must wait until it can get the requested input.
   5. None of the above.
5. The granularity of a lock refers to how much of the database can be locked. Which of these is not a valid lock level?
   1. Database lock.
   2. Table-level lock.
   3. Page-level lock.
   4. Row-level lock.
   5. Field-level lock.
   6. All are valid locking levels.
6. Which is true about locking with finer granularity (smaller units)?
   1. Overhead is reduced, and more transactions can execute concurrently.
   2. Overhead is reduced, but fewer transactions can execute concurrently.
   3. Overhead is increased, but more transactions can execute concurrently.
   4. Overhead is increased, and fewer transactions can execute concurrently.
   5. Locking granularity concerns logical correctness, not performance.
7. When a part of a database is locked for reading, this is
   1. A shared lock (other users can simultaneously apply this type of lock to a resource).
   2. An exclusive lock (no other user can simultaneously apply this type of lock to a resource).
   3. There is no need for a lock when reading.
   4. None of the above.
8. Enforcing foreign-primary key integrity would fall into which ACID category?
   1. Atomicity
   2. Consistency
   3. Isolation
   4. Durability