Advanced Database Management System - Tutorials and Notes: How many disk block accesses required to search for a record 01

## TOPICS (Click to Navigate)

Please visit, subscribe and share 10 Minutes Lectures in Computer Science

# 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: