CS FundamentalsHardGATE CS (PYQ pattern)
A file of 100,000 records of 120 bytes is stored in 4096-byte blocks, each with an 8-byte header (records do not span blocks), sorted on the key. A sparse primary index has one entry (12-byte key + 8-byte block pointer) per data block, and index blocks are 4096 bytes with no header. Using binary search on the index and then one data-block read, what is the worst-case number of block accesses to find a record by key?
- A. 6
- B. 12
- C. 5
- D. 7
Correct answer: C. 5
Blocking factor = floor(4088/120) = 34, so 2942 data blocks. Index entries per block = 204, so the sparse index has 15 blocks; binary search needs ceil(log2 15) = 4 reads, plus 1 data block = 5. Binary search on the data alone would need 12.
More DBMS and SQL questions
- R(A, B, C, D, E) has the functional dependencies DB → A, A → C, D → C, C → B. R is decomposed and one fragment is R1(A, C, D). Counting…
- R(A, B, C, D, E) has FDs A → B, BC → D, D → E, E → B. Which of the following are implied? I. AC → D II. A → E III. AC → E IV. D → B V. CD…
- R(A, B, C, D, E, F) has the functional dependencies B → C, FE → D, EF → B, E → A, CF → E. How many attributes of R are prime (belong to at…
- F = {A→B, B→C, AC→D, D→A} on R(A, B, C, D). Which of the following FD sets is equivalent to F (has exactly the same closure)?
- R(A, B, C, D, E) has FDs A → B, BC → D, D → E. How many of these four binary decompositions are lossless-join? (1) (A, B, C) and (C, D, E)…
- Table N(id) has 10 rows with ids 1 to 10. For SELECT id, NTILE(4) OVER (ORDER BY id) AS g, CUMEDIST() OVER (ORDER BY id) AS cd FROM N…