0
0
DBMS Theoryknowledge~10 mins

Lock-based protocols in DBMS Theory - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to acquire a shared lock on a data item.

DBMS Theory
lock.acquire([1]);
Drag options to blanks, or click blank then click option'
AX
BS
CU
DR
Attempts:
3 left
💡 Hint
Common Mistakes
Using exclusive lock 'X' when only reading is needed.
Using undefined lock types like 'R'.
2fill in blank
medium

Complete the code to release a lock on a data item.

DBMS Theory
lock.[1]();
Drag options to blanks, or click blank then click option'
Await
Bhold
Cacquire
Drelease
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'acquire' instead of 'release' to free a lock.
Using 'wait' which causes the transaction to pause.
3fill in blank
hard

Fix the error in the code to check if a lock is compatible with a shared lock.

DBMS Theory
if (lock.type == '[1]') { allowRead(); }
Drag options to blanks, or click blank then click option'
AS
BX
CU
DN
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing exclusive lock 'X' with shared lock 'S'.
Using undefined lock types like 'N'.
4fill in blank
hard

Fill both blanks to implement strict two-phase locking protocol.

DBMS Theory
beginTransaction();
acquireLock([1]);
// perform operations
[2]();
commitTransaction();
Drag options to blanks, or click blank then click option'
AX
BreleaseLock
CholdLock
DS
Attempts:
3 left
💡 Hint
Common Mistakes
Releasing locks before commit breaks strict 2PL.
Using shared lock 'S' for write operations.
5fill in blank
hard

Fill all three blanks to create a lock table entry for a transaction.

DBMS Theory
lockTable[[1]] = { type: [2], owner: [3] };
Drag options to blanks, or click blank then click option'
AdataItem
BlockType
CtransactionId
DlockOwner
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing owner with data item.
Using incorrect keys in the lock table.