April
1999 QUESTION 4 Total Marks: 20 Marks |
Click here to access other
questions
GRADE A
|
Randomizing algorithms are routines or
programs that compute the address of a record on the basis of its key value.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||
(a) | List the two objective of randomizing algorithms. | [2] | |||||||||||||||||||||||||||||||||||||||||||||||||||
Objectives of
randomizing algorithms - to produce address for each possible key. - to produce even distribution and speed of address location.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||
(b) | Self-addressing with key conversion is one approach to indirect addressing. Assume a file in which there are 10 records in each block, the number of the first block in the storage area in use is 1500, and the lowest key value in the set is 12000. Given a record with key number 13874, derive its location. | [4] | |||||||||||||||||||||||||||||||||||||||||||||||||||
b = ((13874 -
12000)/10 )+ 1500 = 187r4 +1500 = 1687 r4 b = block p = 4+1 = 5 p =position Therefore, they key number 13874 can be found at block 1687 at position 5.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||
(c) | Describe four ways of reducing the search time in a indexed sequential file. | [8] | |||||||||||||||||||||||||||||||||||||||||||||||||||
Ways to reducing the
search time in an indexed sequential file.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||
(d) | For each of the following, identify whether the system is in a consistent or an inconsistent state. If the system is in an inconsistent state, explain why this is so, and how the inconsistency may be resolved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
(i) |
|
[2] | |||||||||||||||||||||||||||||||||||||||||||||||||||
Inconsistent state - Block number 2 : missing block where block no. 2 is not occur in either table. - solution : add to tree list. - it can caused by crash - it will be waste of space.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||
(ii) |
|
[2] | |||||||||||||||||||||||||||||||||||||||||||||||||||
Inconsistent state - Block no. 4 : Duplicate block in tree list. - where block no. 4 occur twice in tree list. - this can only occur in list that is already a linked list, not possible for bit map. - solution : rebuilt tree list.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||
(iii) |
|
[2] | |||||||||||||||||||||||||||||||||||||||||||||||||||
Inconsistent state - Block no. 5 : duplicate data block - when same data block present in 2 different files - if removed 2 files, 2 blocks will be added to tree list twice. - Solutions - add to free space, copy the content of block no. 5 into it, insert the copy into one of the files.
|