0
0
MySQLquery~20 mins

Isolation levels in MySQL - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Isolation Level Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Read Phenomena in Isolation Levels
Which isolation level in MySQL prevents dirty reads but allows non-repeatable reads and phantom reads?
AREAD UNCOMMITTED
BSERIALIZABLE
CREPEATABLE READ
DREAD COMMITTED
Attempts:
2 left
💡 Hint
Think about which isolation level only blocks reading uncommitted changes but does not lock rows for repeatable reads.
query_result
intermediate
2:00remaining
Effect of REPEATABLE READ on Query Results
Given two transactions running under REPEATABLE READ isolation, if Transaction 1 reads rows matching a condition, and Transaction 2 inserts a new matching row before Transaction 1 commits, what will Transaction 1 see if it re-issues the same query?
AIt will see the new row inserted by Transaction 2.
BIt will cause a deadlock error.
CIt will see the original rows only, excluding the new row.
DIt will see partial data causing inconsistent results.
Attempts:
2 left
💡 Hint
REPEATABLE READ guarantees the same rows for repeated reads within the same transaction.
📝 Syntax
advanced
2:00remaining
Setting Isolation Level Syntax
Which of the following MySQL commands correctly sets the transaction isolation level to SERIALIZABLE for the current session?
ASET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
BSET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
CSET GLOBAL TRANSACTION ISOLATION LEVEL SERIALIZABLE;
DSET ISOLATION LEVEL SERIALIZABLE;
Attempts:
2 left
💡 Hint
Consider the scope of the setting and correct syntax for session level.
optimization
advanced
2:00remaining
Choosing Isolation Level for High Concurrency
You have a high-traffic MySQL database with many concurrent read and write transactions. Which isolation level is generally best to balance data consistency and performance?
AREPEATABLE READ
BREAD COMMITTED
CREAD UNCOMMITTED
DSERIALIZABLE
Attempts:
2 left
💡 Hint
Consider the default MySQL isolation level and its trade-offs.
🔧 Debug
expert
2:00remaining
Diagnosing Phantom Reads in SERIALIZABLE Isolation
A developer claims that phantom reads occur even when using SERIALIZABLE isolation level in MySQL. Which of the following is the most likely cause?
AThe transaction is using READ COMMITTED instead of SERIALIZABLE.
BThe storage engine does not support gap locking.
CThe SELECT queries are not using FOR UPDATE or LOCK IN SHARE MODE.
DThe transaction is using REPEATABLE READ, not SERIALIZABLE.
Attempts:
2 left
💡 Hint
Phantom reads are prevented by gap locks which depend on storage engine support.