1.Easy
Which statement deletes a whole table, including its structure?
- ATRUNCATE ROWS
- BDELETE FROM
- CREMOVE TABLE
- DDROP TABLE
2.Easy
What does UNION do with the results of two SELECT queries?
- AKeeps only rows that appear in the first query but not the second
- BCombines them into one result and removes duplicate rows
- CJoins them side by side on a key
- DKeeps only rows that appear in both
3.Easy
Which statement adds a new column to an existing table?
- AALTER TABLE
- BINSERT COLUMN
- CUPDATE TABLE
- DCREATE COLUMN
4.Medium
In relational algebra, the projection operator (π) corresponds to:
- AChoosing which rows satisfy a given condition
- BCombining two tables on a key
- CSorting the result
- DChoosing which columns appear in the result
5.Medium
Why are indexes created on columns?
- ATo save disk space
- BTo prevent NULL values
- CTo make inserts and updates faster on those columns
- DTo speed up searches and joins on those columns
6.Medium
What does SELECT SUM(amount) FROM orders return when the WHERE clause matches no rows?
- ANULL
- B0
- CAn empty string
- DAn error
7.Hard
Why do many DBMSs use strict two-phase locking, holding exclusive locks until commit?
- AIt prevents cascading aborts, because nobody can read uncommitted writes
- BIt removes the need for a transaction log
- CIt allows transactions to read dirty data safely
- DIt makes deadlocks impossible
8.Hard
An app runs UPDATE item SET qty = 4, version = 8 WHERE id = 1 AND version = 7, and reports a conflict if no row was updated. What technique is this?
- ADatabase sharding
- BWrite-ahead logging
- COptimistic concurrency control
- DStrict two-phase locking with row locks
Answer key
- 1. D · DROP TABLE
- 2. B · Combines them into one result and removes duplicate rows
- 3. A · ALTER TABLE
- 4. D · Choosing which columns appear in the result
- 5. D · To speed up searches and joins on those columns
- 6. A · NULL
- 7. A · It prevents cascading aborts, because nobody can read uncommitted writes
- 8. C · Optimistic concurrency control
Full step-by-step solutions: practise this topic on examproblems.com.