CS FundamentalsHardGATE CS (PYQ pattern)
A query joins 5 relations R1..R5 and the optimiser considers every possible join tree, including bushy trees, with every distinct arrangement counted (the join operands are ordered, so R1 ⋈ R2 and R2 ⋈ R1 are different trees; cross products are allowed). How many join trees exist?
- A. 120
- B. 840
- C. 1680
- D. 3360
Correct answer: C. 1680
The number of binary trees with 5 labelled leaves and ordered children is (2n - 2)! / (n - 1)! = 8! / 4! = 1680. Left-deep trees alone number 5! = 120.
More DBMS and SQL questions
- R occupies 1000 pages with 100 tuples per page. S has a B+ tree index on the join attribute (3 levels, so 3 page reads to reach a leaf…
- A table has 100,000 rows in 2500 pages, and a predicate selects 3% of the rows, which are spread uniformly at random over the pages. An…
- A heap file stores 1,000,000 fixed-length records of 150 bytes in 8192-byte blocks with no block header; records do not span blocks. How…
- R(A, B, C, D, E, F) has the functional dependencies BC → D, F → D, F → C, C → D, E → C, DC → E. Counting only the listed dependencies, how…
- R(A, B, C, D, E, F) has the functional dependencies B → E, E → D, B → E, EB → A, A → F. Decompose R into BCNF by this procedure: while…
- R(A, B, C, D, E, F) has FDs A → B, B → C, C → A, AD → E, E → F. How many candidate keys does R have?