CS FundamentalsHardGATE CS (PYQ pattern)
A table of 1,000,000 rows (100 rows per page, 10,000 pages) is clustered on A, with a B+ tree whose leaves hold 200 entries each; reaching the first matching leaf costs 2 internal-node reads plus that leaf. A range predicate selects 1% of the rows. If the scan reads the qualifying leaf pages and then the qualifying data pages, how many page reads are needed?
- A. 102
- B. 152
- C. 10052
- D. 103
Correct answer: B. 152
1% = 10,000 rows. Leaves: 10,000 / 200 = 50 pages (the first included), data: 10,000 / 100 = 100 consecutive pages. Total 2 + 50 + 100 = 152. Ignoring the leaves gives 102; reading one page per row (unclustered) gives about 10,052.
More DBMS and SQL questions
- Sort-merge join of R (200 pages) and S (100 pages) with 15 buffer pages: each relation is fully sorted by external merge sort (pass 0…
- Under the deferred database modification scheme with a log, a crash occurs. The log holds <T1 start>, <T1,A,5>, <T1 commit>, <T2 start>…
- Under strict 2PL, T1 and T2 both hold S(A) and each now requests X(A) (a lock upgrade). T3 holds S(B) and requests X(A). T4 holds X(C) and…
- An ER diagram has a supertype PERSON(pid, name) with disjoint, total specialisation into STUDENT(gpa) and TEACHER(salary). Using the 'one…
- Relations R(A, B, C) with key A and S(C, D) with key C, where R.C is a foreign key to S. A row of S that is referenced by some R rows is…
- PA(id, k): (1,1), (2,2), (3,2), (4,3), (5,NULL), (6,4). PB(k, z): (1,9), (2,9), (2,8), (NULL,7). Let p = rows of SELECT FROM PA LEFT JOIN…