CS FundamentalsVery hardGATE CS (PYQ pattern)
A query scans a table of 11 pages sequentially, 5 times in a row, with a buffer pool of 10 pages (initially empty). How many buffer hits do LRU and MRU replacement give (in that order)?
- A. 0 and 40
- B. 40 and 0
- C. 0 and 10
- D. 40 and 40
Correct answer: A. 0 and 40
LRU evicts exactly the page needed next on a cyclic scan larger than the buffer ('sequential flooding'), so every access misses and there are 0 hits. MRU keeps 9 or 10 pages resident and gets many hits on later scans.
More DBMS and SQL questions
- An ER model has entity sets E1, E2, E3 and a weak entity W (identified through E3 by an identifying 1:N relationship). Relationships…
- Entity sets A (6 entities) and B (9 entities) are linked by relationship R. Every A entity must take part in R (total participation) and…
- E1(id, d, s): (1,x,50), (2,x,70), (3,x,70), (4,y,40), (5,y,40), (6,z,90), (7,z,NULL), (8,w,NULL). How many rows does SELECT FROM E1 a…
- LG(g, t, v): (a,1,10), (a,2,15), (a,3,12), (b,1,7), (b,2,7), (b,3,20). What does SELECT SUM(d) FROM (SELECT v - COALESCE(LAG(v) OVER…
- DD(id, k, v): (1,1,a), (2,1,b), (3,2,c), (4,2,d), (5,2,e), (6,3,f), (7,NULL,g), (8,NULL,h). A cleanup runs DELETE FROM DD WHERE id NOT IN…
- TP(g, id, s): (a,1,90), (a,2,90), (a,3,80), (a,4,70), (b,5,60), (b,6,60), (b,7,60), (c,8,50). Let n1, n2, n3 be the numbers of rows with…