1.Easy
What is a composite key?
- AA key that allows duplicate values
- BA key made up of two or more columns
- CA key stored in a separate table
- DA key that is generated by the database
2.Easy
Which rows does WHERE price BETWEEN 10 AND 20 select?
- ARows with price outside the range 10 to 20
- BRows with price above 10 and below 20, excluding 10 and 20
- CRows with price equal to 10 or 20 only
- DRows with price from 10 to 20, including 10 and 20
3.Easy
Which statement adds a new column to an existing table?
- AUPDATE TABLE
- BINSERT COLUMN
- CCREATE COLUMN
- DALTER TABLE
4.Medium
Which ACID property means concurrent transactions do not see each other's unfinished changes?
- AAtomicity
- BIsolation
- CDurability
- DAvailability
5.Medium
A column holds the values 10, 20 and NULL. What does AVG(col) return?
- A15
- B10
- CNULL
- D30
6.Medium
Which query returns the number of different cities in the customers table?
- ASELECT COUNT(city) FROM customers GROUP BY city
- BSELECT COUNT(DISTINCT city) FROM customers
- CSELECT SUM(DISTINCT city) FROM customers
- DSELECT DISTINCT COUNT(city) FROM customers
7.Hard
Two-phase locking (2PL) ensures:
- AThat transactions never wait
- BConflict-serializable schedules
- CThat no locks are needed
- DThat deadlocks can never happen
8.Hard
What is a phantom read?
- AA repeated query returns new rows inserted by another committed transaction
- BReading uncommitted changes
- CReading data that was never written
- DA query that returns no rows
Answer key
- 1. B · A key made up of two or more columns
- 2. D · Rows with price from 10 to 20, including 10 and 20
- 3. D · ALTER TABLE
- 4. B · Isolation
- 5. A · 15
- 6. B · SELECT COUNT(DISTINCT city) FROM customers
- 7. B · Conflict-serializable schedules
- 8. A · A repeated query returns new rows inserted by another committed transaction
Full step-by-step solutions: practise this topic on examproblems.com.