1.Easy
What does ROLLBACK do in a transaction?
- AUndoes the changes made since the transaction began
- BSaves all changes of the transaction permanently to disk
- CRepeats the last statement
- DDeletes the table
2.Easy
In a LIKE pattern, what does the % wildcard stand for?
- AAny sequence of zero or more characters
- BExactly one character in that position of the string
- CThe end of the string
- DAny single digit
3.Easy
A customer can place many orders, but each order belongs to exactly one customer. What type of relationship is this?
- AZero-to-zero
- BMany-to-many
- COne-to-many
- DOne-to-one
4.Medium
Third normal form (3NF) removes:
- ATransitive dependencies between non-key attributes
- BComposite keys
- CAtomic values
- DRedundant indexes on columns that are not part of a key
5.Medium
Second normal form (2NF) removes:
- AForeign keys
- BPartial dependencies of non-key columns on part of a composite key
- CAll NULL values
- DTransitive dependencies between non-key columns via another non-key column
6.Medium
Which query lists customers who have never placed an order?
- ASELECT c.name FROM customers c LEFT JOIN orders o ON o.customer_id = c.id WHERE o.id IS NOT NULL
- BSELECT c.name FROM customers c LEFT JOIN orders o ON o.customer_id = c.id WHERE o.id = NULL
- CSELECT c.name FROM customers c INNER JOIN orders o ON o.customer_id = c.id WHERE o.id IS NULL
- DSELECT c.name FROM customers c LEFT JOIN orders o ON o.customer_id = c.id WHERE o.id IS NULL
7.Hard
Why do many DBMSs use strict two-phase locking, holding exclusive locks until commit?
- AIt allows transactions to read dirty data safely
- BIt removes the need for a transaction log
- CIt makes deadlocks impossible
- DIt prevents cascading aborts, because nobody can read uncommitted writes
8.Hard
Two transactions both read stock = 10, each subtracts 1 and writes the result, giving 9 instead of 8. Which anomaly is this?
- ALost update
- BDirty read
- CDeletion anomaly
- DPhantom read
Answer key
- 1. A · Undoes the changes made since the transaction began
- 2. A · Any sequence of zero or more characters
- 3. C · One-to-many
- 4. A · Transitive dependencies between non-key attributes
- 5. B · Partial dependencies of non-key columns on part of a composite key
- 6. D · SELECT c.name FROM customers c LEFT JOIN orders o ON o.customer_id = c.id WHERE o.id IS NULL
- 7. D · It prevents cascading aborts, because nobody can read uncommitted writes
- 8. A · Lost update
Full step-by-step solutions: practise this topic on examproblems.com.