CS FundamentalsHardGATE CS (PYQ pattern)

A B+ tree index is built on (a, b) in this order. For which of these predicates can a search descend directly to a contiguous range of entries that contains exactly the qualifying rows (no scanning of non-qualifying entries inside the range)? I. a = 5 AND b = 10 II. a = 5 AND b > 10 III. a > 5 AND b = 10 IV. b = 10

  1. A. I only
  2. B. I and II only
  3. C. I, II and III only
  4. D. II and IV only

Correct answer: B. I and II only

Entries are sorted by a, then b. A = with a = and a range on b is one contiguous run (I, II). With a > 5 the b values restart for each a, so b = 10 matches are scattered (III), and b alone has no leading column (IV).

More DBMS and SQL questions

Exams that ask this topic