Q1A file has r20000 STUDENT records of fixedlength Each reco
Q1.A file has r=20,000 STUDENT records of fixed-length. Each record has the following fields:
NAME (30 bytes), SSN (9 bytes), ADDRESS (40 bytes), PHONE (9 bytes), BIRTHDATE (8 bytes), SEX (1 byte), MAJORDEPTCODE (4 bytes), MINORDEPTCODE (4 bytes), CLASSCODE (4 bytes, integer), and DEGREEPROGRAM (3 bytes). An additional byte is used as a deletion marker. Block size (512 bytes)
a) Calculate the record size R in bytes. .
b) Calculate the blocking factor bfr and the number of file blocks b assuming an unspanned organization.
Solution
Please let me know if you need more information:-
======================================
Given data
NAME= 30B
SSN= 9B
ADDRESS= 40B
PHONE= 9B
BIRTHDATE= 8B
SEX= 1B;
MAJORDEPTCODE= 4B
MINORDEPTCODE= 4B
CLASSCODE = 4B
DEGREEPROGRAM= 3B
a) To calculate the Size R in bytes
We need to sum all the values then R will be summation
R = 30 + 9 + 40 + 9 + 8 + 1 + 4 + 4 + 4 + 3
R =112 (Bytes)
---------------------------------------------------
b) Blocking factor :-
To find blocking factor we need to calulate ( how many records per block ) using formaula
Blocking factor = (block size / R);
Blocking factor = (512/112) [Bytes]
Blocking Factor = 4 recorrds/ block; (Note here we will use Floor not ceil as it must fit to blocks )
Number of file blocks b :-
==================
Number of file block we can find by using Total Number of records and blocking factor.
Now,
Number of fle Blocks b = [ Total Number of records / Blocking factor ]
Number of file Blocks b = [ 20000 / 4 ]
Number of file Blocks b = 5000 Blocks.
Thanks
