CS FundamentalsEasyGATE CS (PYQ pattern)
An equi-width histogram on column A (range 0 to 100, 10,000 rows) has buckets [0,20): 4000, [20,40): 2500, [40,60): 1500, [60,80): 1500, [80,100]: 500 rows. Assuming values are uniform inside each bucket, what is the estimated number of rows satisfying 30 <= A < 70?
- A. 3500
- B. 4500
- C. 3000
- D. 4000
Correct answer: A. 3500
Bucket [20,40) contributes half: 1250; [40,60) fully: 1500; [60,80) half: 750. Total 3500. The uniform assumption over the whole range would give 4000.
More DBMS and SQL questions
- Relations R (1000 tuples), S (2000), T (500). Join selectivities: R–S 0.001, S–T 0.01, R–T 0.0005 (fraction of the cross product that…
- Sort-merge join of R (1000 pages) and S (400 pages) with 20 buffer pages. Each relation is fully sorted by external merge sort (pass 0…
- The owner O of a table issues, in this order (with GRANT OPTION each time): 1) O grants SELECT to A; 2) O grants SELECT to B; 3) A grants…
- ACC(id, bal): (1,100), (2,200), (3,300), (4,400). A row-level trigger AFTER UPDATE ON ACC FOR EACH ROW WHEN NEW.bal > 250 inserts (NEW.id…
- K(a UNIQUE, b CHECK (b > 0)) is empty. These rows are inserted one by one, ignoring any row that violates a constraint: (1,5), (1,6)…
- G(g, x): (a,5), (a,7), (b,4), (b,4), (b,4), (c,20), (d,NULL), (d,1). How many groups does SELECT g FROM G GROUP BY g HAVING SUM(x) >…