Fundamentals of Database Systems: Assignment: 4 Due Date: 28th August, 2017
Fundamentals of Database Systems: Assignment: 4 Due Date: 28th August, 2017
Assignment: 4
Due Date: 28th August, 2017
Instructions
This question paper contains 15 questions in 5 pages.
Q1: Assume that a B-tree has been built with data pointers of size 2B, tree pointers of size 3B and key size 5B. The
size of each page in the system is 128B. What is the branching factor of the B-tree?
A. 12
B. 14
C. 13
D. 10
Q2: Assume that a data file contains 1000 records that are ordered by a key attribute A, and a primary index on
attribute A is built. Let the size of key be 5B and block pointer be 5B. Each block of the system is of 105B, out of
which 100B can be used to store data and 5B is reserved for storing meta data. How many disk accesses will be
required to fetch the record using the index in average case?
A. 3
B. 4
C. 5
D. 6
Explanation: Number of disk access for binary search the index (100/10 = 10blocks) plus one access to
fetch data; dlog(100/10)e + 1
Q3: Consider a relation R(a, b, c) ordered on a non-key attribute b, and an index is maintained on attribute c. To
evaluate the following expression, which is a better order of operation?
1
Fundamentals of Database Systems Assignment: 4
Explanation: The size of block and file size is not mentioned hence we cannot figure out the actual block
transfers required to fetch index entry or to binary search the record
Q4: Consider two relations R and S of size 600 and 500 bytes repectively. The size of a tuple in both relations is 20B.
The block size of the system is 200B. How many extra block transfers would be required, in the worst case, if
nested loop join is used instead of block nested loop join technique to compute R Z S ?
A. 78
B. 93
C. 66
D. 105
Explanation: Relation R and S require 3 blocks each and have 30 and 25 tuples respectively. Since S is the
smaller thus it will be choose as inner relation. In worst case, one block of each relation can fit in memory,
so the number of block transfers require for nested join is (25 × 3) + 3 = 78 and for block nested join is
(3 × 3) + 3 = 12. therefore, if we use nested join instead of block nested join we will require 78 − 12 = 66
extra block transfers.
Q5: Consider the following operations and the associated list of techniques.
1. Deduplication: Hashing
2. Difference: Hashing, Sorting
3. Full Outer Join: Block Nested join, Index-Nested join
4. Left-Outer Join: Hash join, Index-Nested join
Which of these operations can be implemented using all the techniques mentioned in the corresponding list?
A. Only deduplication, full outer join and left-outer join
B. Only deduplication
C. Only deduplication and full outer join
D. Only difference and full outer join
Page 2 of 5
Fundamentals of Database Systems Assignment: 4
B. Main Memory
C. Magnetic Disks (HDD)
D. Optical Disks (CD)
Explanation: Cache and Main Memory are volatile, Optical Disks would not genearally allow update oper-
ations (or would make them very slow).
Q8: Search time is of crucial importance for an indexing scheme. What are the other points on which one should
evaluate an indexing scheme?
A. Modification overhead
B. Space overhead
C. Both modification and space overheads
D. Neither modification nor space overhead
Q9: In what kind of index does an index entry appear only for certain keys?
A. Dense
B. Sparse
C. Simple
D. Inner
Explanation: c ≥ γ × m + η × (m + 1)
2 × 1024 ≥ 32 × m + 8 × (m + 1)
∴ m = b51c = 51
Number of records = m × (m + 1)2 = 51 × 522 = 137904.
Page 3 of 5
Fundamentals of Database Systems Assignment: 4
Explanation: c ≥ γ × m + η × m + η × (m + 1)
2 × 1024 ≥ 32 × m + 8 × (m + 1) + 8 × m
∴ m = b42.5c = 42
where the possible values of year, department and program are as follows:
year = {2011, 2012, 2013, 2014}; department = {CS, EE}; program = {MS, MTech, PhD, BTech}.
What will be the bitmaps used and the result for the query: Find out students from year 2013 that are enrolled in
MTech program.
A. bitmap(2013) = 011100, bitmap(MTech) = 011010, result = 011000
B. bitmap(Year) = 0132, bitmap(Program) = 0330, result = 2
C. bitmap(Year) = 0132, bitmap(Program) = 0330, result = 0130
D. bitmap(2013) = 100011, bitmap(MTech) = 100101, result = 100111
Q13: In an external merge sort, where number of blocks in the relation is 324, suppose we can put only 4 blocks at a
time into the memory. In the worst case, how many total block transfers will happen?
A. 2592
B. 3240
C. 3888
D. 4230
Explanation: b = 324, M = 4
Number of block transfers = 2b(dlog M−1 db/Mee + 1)
= 2 × 324 × (dlog3 81e + 1)
= 2 × 324 × 5
= 3240
Page 4 of 5
Fundamentals of Database Systems Assignment: 4
Q14: In an external merge sort, where number of blocks in the relation is 324, suppose we can put only 4 blocks at a
time into the memory. In the worst case, how many total seeks will happen?
A. ∼2400
B. ∼2700
C. ∼3000
D. ∼3300
Explanation: b = 324, M = 4
Number of seeks = 2db/Me + 2b(dlog M−1 db/Mee)
= 2 × 81 + 2 × 324 × (dlog3 81e)
= 162 + 2 × 324 × 4
= 2754
Q15: Consider the simple nested-loop join of the following two relations r and s.
Relation r s
Tuples (n) 2400 1500
Blocks (b) 40 50
Assuming the worst case memory availability, i.e., the memory can hold only one block of each relation at a time,
what is the number of block transfers and seeks?
A. Transfers = 120040, seeks = 4800
B. Transfers = 4800, seeks = 120040
C. Transfers = 60050, seeks = 3000
D. Transfers = 3000, seeks = 60050
Explanation: Outer relation should be smaller, thus s should be the outer loop and r the inner.
Transfers = b s + n s × br = 50 + 1500 × 40 = 60050
Seeks = 2 × n s = 3000.
Page 5 of 5