Monday, November 9, 2020

How many disk block accesses required to search for a record 01

MCQ in database management systems, quiz questions with answers in data storage and access.

How many disk block accesses required to search for a record in a sorted file?

Suppose we have a database file of 10,000 records, each record is of size 100 bytes. If the disk blocks are 512 bytes long, block addresses are 4 bytes long (i.e., to specify address to a block requires 4 bytes), pointers to records are 4 bytes long (i.e., a pointer which specifies address of the record in the block needs 5 bytes), and the records are sorted in search key order, what would be the number of disk accesses to do a successful lookup for a record?

a) 11

b) 5

c) 100

d) 256

Answer: (a) 11

Given,

            Number of records = 10000

            Record size = 100 bytes

            Disk block size = 512 bytes;

Therefore number of records per block (blocking factor) is 512/100 = 5. 

Since 5 records per block, then we have file size N=  10,000/5 = 2,000 disk blocks.

Searching in a sorted file

The file has 2000 blocks and binary search will take log2N = log22000 = 11 disk block accesses.

 

************************
Related posts:


Quiz questions with answers on DBMS introduction concepts

Solved quiz questions on disk and storage access in DBM

How to measure the number of disk accesses required in DBMS

How to search for a record in a sorted database file

No comments:

Post a Comment

Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents

data recovery