CS FundamentalsHardTCS NQT · Infosys interview pattern
Account X holds 100. T1 reads X (100); T2 reads X (100); T1 writes X = 150 and commits; T2 writes X = 80 and commits. What is the final value of X, and what is this anomaly called?
- A. 150; lost update
- B. 130; dirty read
- C. 80; lost update
- D. 80; phantom read
Correct answer: C. 80; lost update
T2’s write was based on its stale read and overwrites T1’s committed change, leaving 80. T1’s update is lost. No uncommitted data was read, so it is not a dirty read, and no rows appear or vanish, so it is not a phantom.
More DBMS and SQL questions
- Table Orders has a composite B-tree index on (city, amount). Which WHERE clause can use this index to narrow the search most effectively?
- Which of these queries is NOT valid in standard SQL?
- Table Orders(id, cust, city, amount) rows: (1, 'Ana', 'Pune', 500), (2, 'Ben', 'Delhi', NULL), (3, 'Ana', 'Pune', 300), (4, 'Chen'…
- Table Orders(id, cust, city, amount) rows: (1, 'Ana', 'Pune', 500), (2, 'Ben', 'Delhi', NULL), (3, 'Ana', 'Pune', 300), (4, 'Chen'…
- Table Orders(id, cust, city, amount) rows: (1, 'Ana', 'Pune', 500), (2, 'Ben', 'Delhi', NULL), (3, 'Ana', 'Pune', 300), (4, 'Chen'…
- Table Orders(id, cust, city, amount) rows: (1, 'Ana', 'Pune', 500), (2, 'Ben', 'Delhi', NULL), (3, 'Ana', 'Pune', 300), (4, 'Chen'…