Difficulty: Hard
Which isolation level aims to make transactions behave serially?
A Read uncommitted
B Read committed
C Read only
D Serializable
Answer: D. Serializable. Serializable isolation aims for an outcome equivalent to some serial transaction order.
In what way does MVCC let readers avoid blocking writers?
A Reads a consistent row version
B Disables transaction commits
C Locks every database table
D Deletes active row versions
Answer: A. Reads a consistent row version. MVCC readers can access a suitable version while writes create new versions.
If a repeated query returns a new matching row, which anomaly occurred?
A Write skew
B Phantom read
C Dirty read
D Lost update
Answer: B. Phantom read. A phantom read occurs when a repeated predicate query finds new rows.
When a row changes between two reads in one transaction, what happened?
A Dirty write
B Deadlock
C Non-repeatable read
D Phantom deletion
Answer: C. Non-repeatable read. A non-repeatable read observes different values for the same row.
Two transactions each pass separate checks but jointly violate a rule. What can occur?
A Dirty read
B Index drift
C Lost insert
D Write skew
Answer: D. Write skew. Write skew can arise when transactions read overlapping state and update different rows.
What condition creates a classic database deadlock?
A Cyclic resource waiting
B A stale backup
C A missing index
D A large table
Answer: A. Cyclic resource waiting. A deadlock requires transactions to wait in a cycle for held resources.
Which log rule supports crash recovery with write-ahead logging?
A Data pages before log records
B Log records before data pages
C Skip logs for committed writes
D Delete logs before checkpoints
Answer: B. Log records before data pages. WAL requires relevant log records to reach durable storage before data pages.
Which write order does write-ahead logging require?
A Replay latest query alone
B Copy active memory pages
C Restore backup then replay logs
D Restore indexes only
Answer: C. Restore backup then replay logs. Recovery restores a base backup and applies logs up to the target time.
Point-in-time recovery rebuilds a target moment using which steps?
A Four hours of downtime always
B Four hours to restart
C Four hours of query time
D Four hours of changes
Answer: D. Four hours of changes. RPO defines a maximum acceptable data-loss window, here four hours.
With an RPO of four hours, what is the maximum accepted data gap?
A Restore service within four hours
B Up to four hours
C Finish queries in four hours
D Keep backups four hours old
Answer: A. Restore service within four hours. RTO sets a target recovery time for restoring service.
When most requests hit one shard key, what risk appears?
A Normalization anomaly
B Hot shard
C Replica checksum
D Phantom read
Answer: B. Hot shard. A skewed shard key can overload one node and limit capacity.
How can partition pruning reduce query work?
A Rebuild the whole database
B Duplicate every matching row
C Skip irrelevant partitions
D Disable all table indexes
Answer: C. Skip irrelevant partitions. Partition pruning lets a query avoid scanning partitions outside its filter.
Which index can satisfy a query without reading table rows?
A Foreign key
B Hash partition
C Cluster address
D Covering index
Answer: D. Covering index. A covering index includes the columns needed by a query.
Wrapping an indexed column in a function can cause which issue?
A Predicate becomes non-sargable
B Transaction becomes atomic
C Table loses its schema
D Primary key becomes nullable
Answer: A. Predicate becomes non-sargable. Wrapping an indexed column in a function can prevent efficient index range use.
Which optimizer estimate strongly affects join-plan selection?
A Backup file names
B Rows produced by each step
C Font size of reports
D Number of user passwords
Answer: B. Rows produced by each step. Cardinality estimates influence join order and chosen execution methods.
What is a main risk of cascading deletes?
A Slower screen rendering only
B Automatic backup creation
C Unexpected related data removal
D Guaranteed duplicate prevention
Answer: C. Unexpected related data removal. Cascades can remove dependent records beyond the operator’s immediate selection.
How does two-phase commit coordinate a distributed transaction?
A Index then partition data
B Backup then compress files
C Read then sort rows
D Prepare then commit decision
Answer: D. Prepare then commit decision. Two-phase commit asks participants to prepare before a coordinator decides commit or rollback.
When a distributed workflow spans independent services, what pattern supports recovery?
A Saga with compensating actions
B Shared global password
C Single local rollback only
D Unlogged table truncation
Answer: A. Saga with compensating actions. A saga uses local transactions and compensating actions across services.
Which technique tracks row changes for downstream systems?
A Data masking
B Change data capture
C Table normalization
D Query federation
Answer: B. Change data capture. CDC captures inserts, updates, and deletes for downstream processing.
What does replication lag describe?
A Duration of a local query
B Age of a schema file
C Delay before copies match
D Time to create an index
Answer: C. Delay before copies match. Replication lag is the delay before updates reach a replica.
Which dimension method retains old and new values?
A Current-only lookup
B Overwrite-only dimension
C Type zero dimension
D Type two slowly changing dimension
Answer: D. Type two slowly changing dimension. Type 2 stores a new row version to retain historical attributes.
Which privilege pattern limits a database account’s exposure?
A Least privilege
B Shared administrator role
C Public write access
D Permanent root access
Answer: A. Least privilege. Least privilege grants only the permissions needed for assigned work.
Which protection safeguards stored database files?
A Query caching
B Encryption at rest
C Schema validation
D Row sorting
Answer: B. Encryption at rest. Encryption at rest protects data stored on database media.
Before relying on a backup, what verifies that it can be restored?
A Unverified copy count
B Extra screen theme
C Routine restore test
D Longer table names
Answer: C. Routine restore test. Restore tests confirm that backups can actually be used.
What tradeoff can arise when replicas serve stale reads?
A Schema versus formatting
B Sorting versus grouping
C Indexes versus keys
D Freshness versus availability
Answer: D. Freshness versus availability. Replicas can improve resilience and read scale while serving data that is not fully current.