QuizzesRow-Level vs Table-Level Locking — Concept Check
intermediate
mysql

Row-Level vs Table-Level Locking — Concept Check

Questions on Row-Level vs Table-Level Locking. InnoDB row-level locking (shared S, exclusive X, intent locks) allows high concurrency; table-level locks (LOCK TABLES) are used for bulk operations and DDL on MyISAM.

7 minutes 7 questions Pass at 70%
Time Limit
7 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

7 questions on Row-Level vs Table-Level Locking — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A transaction holds an exclusive lock on a row in the 'orders' table. What happens if another transaction tries to read the same row?

    • AIt waits until the lock is released.
    • BIt reads the data but cannot write.
    • CIt reads the data immediately.
    • DIt reads the data with a warning.
  2. 2.In a high-concurrency application, you notice frequent deadlocks. What might be a contributing factor?

    • AImproper use of table-level locks.
    • BNot using intent locks manually.
    • CExcessive use of shared locks.
    • DUsing row-level locking without intent locks.
  3. 3.A developer sets the isolation level to READ COMMITTED. What is a potential consequence?

    • AExclusive locks block all reads.
    • BPhantom reads are possible.
    • CGap locks prevent phantoms.
    • DIntent locks are disabled.
  4. 4.When would you use LOCK TABLES with InnoDB?

    • ATo improve row-level lock granularity.
    • BTo prevent deadlocks in high-concurrency scenarios.
    • CTo automatically manage intent locks.
    • DFor bulk operations that must prevent concurrent access.
  5. 5.A transaction locks a row with status=3 in the 'orders' table. What happens if another transaction tries to insert a row with status=2?

    • AIt triggers a phantom read.
    • BIt waits for an exclusive lock.
    • CIt inserts successfully.
    • DIt is blocked by a gap lock.
  6. 6.What is the role of intent locks in InnoDB?

    • AThey prevent all other transactions from accessing the table.
    • BThey are manually set to manage lock contention.
    • CThey signal row-level locks to prevent full table locks.
    • DThey allow concurrent writes to the same row.
  7. 7.During a long-running transaction, you attempt an ALTER TABLE command. What happens?

    • AThe command executes immediately, ignoring the transaction.
    • BThe transaction is rolled back to allow the command.
    • CThe command fails due to metadata lock contention.
    • DThe ALTER TABLE command waits for the transaction to complete.