Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(a) Both arrays and records can be used to store aggregates of data elements. Ex

ID: 3830209 • Letter: #

Question

(a) Both arrays and records can be used to store aggregates of data elements. Explain why accessing a field of a record is usually more efficient than accessing an element of an array. (b) Record types are sometimes implemented in a programming language so that the memory required by a record variable may be more than the sum of the memory required by all its fields. That is, there may be "holes" between adjacent fields of a record storage, where the "holes" are byte(s) that is/are allocated to the record, but are not used to store any of the fields. i. Give an advantage of this implementation design. ii. Give a disadvantage of this implementation design. iii. Discuss how this design would affect the implementation of some record type operations.

Explanation / Answer

answer 1.

Arrays:-array is a storage process or a data storage system ,which is usually used for block based ,file based or object based storage.

in programming ,array is refered to as the series of objects of same size,it could be integer.

RECORD:- record it bit different from array,it can have different sized data,a record can be of  different types and different meanings, however a record as a whole usually describes an entity.Records are distinguished from arrays by the fact that their number of fields is typically fixed, each field has a name, and that each field may have a different type.

acessing the fields of record is usually more efficient than accesing the elements of array,because An array element is accessed by writing the identifier of the array followed by the subscript in square brackets.if we want to access an array we need to follow index wise elements and it will check all the elements before the required one,where as in records,the elements are fixed in the particular fields,which makes it easy to access it,and find the required field or the element.record fields are stored in consecutive manner,and they can be accesed easily.

answer2 :-

1.advantages of implementation design :-when there will be more memory,there will not be the problem ,because as there will be free space,no trafficinkg will be caused,and when required more data could be added also.

where as there is a disadvantage also,the vacant place or holes will create a problem because there could be illusion of having the data,but wrong field will be accesed whic will give false solution.