• edited by
10,620 views
19 19 votes

Given a block can hold either $3$ records or $10$ key pointers. A database contains n records, then how many blocks do we need to hold the data file and the dense index

  1. $13n/30$
  2. $n/3$
  3. $n/10$
  4. $n/30$

3 Answers

Best answer
23 23 votes
total number of block required by data file = n/3

total number of records needed by pointer = n/10. ( key pointer = no of keys)

total blocks = n/3+n/10 =13n / 30
13 13 votes

This is a question on simple indexing and so we should not bother about higher level of indexing..

So no of records given  =  n

 no of records per data block given = 3

So no of data blocks    =  n / 3

Now we know in dense index ,

No of <key,pointer> pairs in dense index = No of data records 

So

No of <key,pointer> pairs in 1st level index here = n

So no of  index blocks  = n/10 [ As there are 10 such pairs per index block]

So total no of data blocks and index blocks required  =  n / 3 + n / 10

                                                                             =  13 n / 30

Hence A) should be the correct answer..

2 2 votes

For $n$ records, blocks required = $\frac{n}{3}$

For $n$ indices in the index file, blocks required = $\frac{n}{10}$

Total = $\frac{n}{3}+\frac{n}{10}$ = $\frac{10n}{30}+\frac{3n}{30}$ = $\frac{13n}{30}$

Option A


Bonus:-

In case of sparse indexing:

For $n$ records, blocks required = $\frac{n}{3}$

For $\frac{n}{3}$ indices in the index file, blockes required = $\frac{n}{30}$

Total = $\frac{n}{3}+\frac{n}{30}$ = $\frac{10n}{30}+\frac{n}{30}$ = $\frac{11n}{30}$


For dense indexing, we have a pointer (index in the index file) for each record.

For sparse indexing, we have a pointer for each block. (More specifically for every first record of the block)

Answer:
Position:
Show:

Related questions

41 41 votes
9 answers 9 answers
14.5k
14.5k views
Kathleen asked Sep 22, 2014
14,521 views
The range of integers that can be represented by an $n$ bit $2’s$ complement number system is:$-2^{n-1} \text{ to } (2^{n-1} -1)$$-(2^{n-1} -1) \text{ to } (2^{n-1} -1)$$...
58 58 votes
9 answers 9 answers
48.5k
48.5k views
Kathleen asked Sep 14, 2014
48,454 views
The number of tokens in the following C statement isprintf("i=%d, &i=%x", i, &i);$3$$26$$10$$21$
9 9 votes
3 answers 3 answers
5.3k
5.3k views
go_editor asked Jun 19, 2016
5,348 views
If a node has $K$ children in $B$ tree, then the node contains exactly _____ keys.$K^2$$K-1$$K+1$$\sqrt{K}$
3 3 votes
1 1 answer
5.0k
5.0k views
go_editor asked Jun 17, 2016
4,959 views
Consider the following schema:$\textsf{Emp (Empcode, Name, Sex, Salary, Deptt)}$A simple SQL query is executed as follows:SELECT Deptt FROM Emp GROUP by Dept Having avg (...