Suppose that only 80% of the STUDENT records from Exercise 17.28 have a value for PHONE, 85% for MAJORDEPTCODE, 15% for MINORDEPTCODE, and 90% for DEGREEPROGRAM, and we use a variable-length record file. Each record has a 1-byte field type for each field occurring in the record, plus the 1-byte deletion marker and a 1-byte end-of-record marker. Suppose we use a spanned record organization, where each block has a 5-byte pointer to the next block (this space is not used for record storage).

(a) Calculate the average record length R in bytes.

(b) Calculate the number of blocks needed for the file.


(a) Assuming that every field has a 1-byte field type, and that the fields not mentioned
above (NAME, SSN, ADDRESS, BIRTHDATE, SEX, CLASSCODE) have values in every
record, we need the following number of bytes for these fields in each record, plus 1
byte for the deletion marker, and 1 byte for the end-of-record marker:
R fixed = (30+1) + (9+1) + (40+1) + (8+1) + (1+1) + (4+1) +1+1 = 100 bytes
For the fields (PHONE, MAJORDEPTCODE, MINORDEPTCODE DEGREEPROGRAM), the
average number of bytes per record is:
R variable = ((9+1)*0.8)+((4+1)*0.85)+((4+1)*0.15)+((3+1)*0.9)
= 8+4.25+0.75+3.6= 16.6 bytes
The average record size R = R fixed + R variable = 100 + 16.6 = 116.6 bytes
The total bytes needed for the whole file = r * R = 20000 * 116.6 = 2332000 bytes

(b) Using a spanned record organization with a 5-byte pointer at the end of each block,
the bytes available in each block are (B-5) = (512 - 5) = 507 bytes.
The number of blocks needed for the file are:
b = ceiling((r * R) / (B - 5)) = ceiling(2332000 / 507) = 4600 blocks
(compare this with the 5000 blocks needed for fixed-length, unspanned records in
Problem 4.19(b))

Computer Science & Information Technology

You might also like to view...

They programmed Watson to do this as the game progressed.

a. think b. learn c. determine the category d. ask intelligent questions

Computer Science & Information Technology

Sometimes reducing the margins of a document is a technique used to fit all the text onto one page versus having one or two extra lines on a second page

Indicate whether the statement is true or false

Computer Science & Information Technology

A(n) ________ is a group of cells which have been selected at the same time

Fill in the blank(s) with correct word

Computer Science & Information Technology

In C++, throw is a(n) ____________________ word.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology