August
1999 QUESTION 2 Total Marks: 20 Marks |
Click here to access other
questions
SUGGESTED SOLUTIONS |
(a) | (i) Explain what is meant by the terms FIFO
data structures and LIFO data structures. (ii) Describe what is meant by the term abstraction. (iii) Identify and explain the difference between a static and dynamic data structure. |
[2] [2] [2] |
||||||||
(i)
(ii) Abstraction means
(iii)
|
||||||||||
(b) | You are to develop a book control
system for a library. The library needs to store the following information on each book :
TYPE Date = RECORD
(i) Define a data structure Book, which contains all of the information above. (ii) The library holds 1000 books in total. Define a suitable static data structure, called StaticLibraryCatalogue which will hold the details of all 1000 books. (iii) Suppose that more books need to be added to the library. Suggest a suitable dynamic data structure, called DynamicLibraryCatalogue which could be used to hold the data as the number of books held in the library changes, and explain why your suggested data structure is suitable. (iv) Implement a function (v) A problem exits with the year field in date. Explain what this problem is, and give a new definition of the Date structure which solves it. |
[4]
|
||||||||
(i) A
sample definition of Book follows: Type Book = RECORD
END; (ii) A sample definition of
StaticLibraryCatalogue follows: (iii)
(iv) A sample of definition of IsDateValid follows: FUNCTION IsDateValid(MyDate : Date) (v)
|