CS FundamentalsHardGATE CS
Which locking scheme guarantees BOTH freedom from deadlock and schedules without cascading rollback?
- A. Strict 2PL alone, holding exclusive locks until commit
- B. Conservative 2PL alone, taking all locks before starting
- C. Basic 2PL with lock upgrades from shared to exclusive
- D. Conservative 2PL that also holds exclusive locks until commit
Correct answer: D. Conservative 2PL that also holds exclusive locks until commit
Conservative 2PL acquires every lock before starting, so no transaction waits while holding locks (no deadlock), but it may release X locks early. Strict 2PL holds X locks to commit (cascadeless) but can deadlock. Combining both gives both guarantees.
More DBMS and SQL questions
- Table T has 7 rows. What does SELECT COUNT() FROM T HAVING COUNT() > 10; return? (Standard SQL; SQLite accepts HAVING without GROUP BY…
- Table U(x INT UNIQUE) is empty. These statements run one at a time: INSERT (1); INSERT (NULL); INSERT (NULL); INSERT (1). How many succeed…
- Table K(amt INT CHECK (amt > 0)) is empty. These run one at a time: INSERT (-5); INSERT (NULL); INSERT (0); INSERT (3). How many rows does…
- P(id PRIMARY KEY) has rows 1, 2. C(id, pid REFERENCES P ON DELETE CASCADE) has (10, 1), (11, 1), (12, 2). G(id, cid REFERENCES C ON DELETE…
- R(A, B, C) is decomposed into R1(A, B) and R2(B, C). Which condition is necessary and sufficient (under FDs only) for the decomposition to…
- R(A, B, C) with FDs A → B and B → C has primary key A. A designer moves to R1(A, B) and R2(B, C). Which statement is correct?