A patient record consists of the following: 3 fixed-length fields: the patient’s
ID: 3711921 • Letter: A
Question
A patient record consists of the following:
3 fixed-length fields: the patient’s date of birth, social-security number, and patient ID,
each field is 10 bytes long.
It also has the following 3 variable-length fields: name, address, and patient history.
If pointers within a record require 4 bytes, and the record length is a 4-byte integer, how many bytes, exclusive of the space needed for the variable length fields, are needed for the record ? You may assume that no alignment of fields is required.
Question 1.2 Record Layout (5 Points)
Suppose records are as in Question 1.1, and the variable length fields name, address, and history each have a length that is uniformly distributed. For the name, the range is 10 - 50 bytes; for address it is 20 - 80 bytes, and for history it is 0 - 1000 bytes. What is the average length of a patient record?
Question 1.3 Record Layout (5 Points)
Suppose that the patient records of Question 1.1 are augmented by an additional repeating field that represents cholesterol tests. Each cholesterol test requires 16 bytes for a date and an integer result of the test. Show the layout of patient records if:
a. The repeating tests are kept with the record itself.
b. The tests are stored on a separate block, with pointers to them in the record.
Explanation / Answer
Solution:
Note: 1.1 and 1.2 is answered, please repost 1.3.
Fixed length records will be
10+10+10= 30 bytes
for variable length
3 pointers are required for three fields
which means 12 bytes and 12 bytes are for the record length
so total will be 30+12+12 = 54 bytes
1.2)
The average from name will be 30 bytes
The average from address field will be 50 bytes
The average history will be 500 bytes
total average will be 500+50+30 = 580 bytes
and fixed lengths are 30 bytes
so final total will be = 580+30 = 310 bytes
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.