August 2000 QUESTION 2 Total Marks: 15 Marks |
Click here to access other
questions
Click to access |
You are to implement a data structure which can be used to store details of Informatics students. Each student is to be represented by a record, and the system requires to store details of each students name, number and whether or not the student has passed or failed. (a) Define a simple enumerated data type, called ResultsCategory, which can take on either of the values Pass or Fail. [1 mark] (b) Define a suitable data structure for a student, called Student, which contains the students name - a string of up to 50 characters in length, the students identification number, which is an integer, and the students result, which is of type ResultsCategory given above. [4 marks] (c) It has been decided that the complete
set of all student details should be held in a double linked list.
Give a definition of a double linked list, called StudentList, where
nodes in the list consist of a Student structure and pointers to the
next and previous nodes in the list. (d) Define a procedure, called Separate,
the signature of which is given below, which takes a StudentList,
and references to two other StudentLists. On termination, the procedure
should have copied all of the students in the original list with passes
into one list, and fails into the other. You may wish to use the standard
list manipulation function Add, which takes a list element E and adds
it to the list L. You are not required to implement Add. |