Suppose a heap file contains 100,000 records of 400 bytes each. Block size is 4096. During processing, 2 records get added to the end of the file for every record deleted somewhere within the file. This continues until the file has 200,000 active records.
a. How many disk blocks does the file
currently occupy?
b. How many records have been deleted?
c. How percentage of the space within the file is not being
used?
`Hey,
Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.
a) 29,296.875
b) 100,000
Explanation:
Let's start with just a basic question - if you delete the 100,000 starting records and there are 2 records added for each of those, then you end up with 200,000 records, right?
So the number of records deleted is 100,000.
If the heap file grows without being rebuilt to reclaim the space of the deleted records, then your heap file will have allocated space for the initial 100,000 records (even though they're deleted) and then 200,000 at the end.
So that mean your heap file would be 300,000 records x 400 bytes per record = 120,000,000 bytes in total size.
To determine disk blocks, divide that 120,000,000 bytes by 4,096 bytes per block.
Finally, knowing there's 100k deleted and 200k active records, you should be able to answer that final question about percent of unused space.
Its about 50%
Kindly revert for any queries
Thanks.
Get Answers For Free
Most questions answered within 1 hours.