December
1999 QUESTION 2 Total Marks: 15 Marks |
Click here to access other
questions
Click to access |
(a) |
One of the most important features of object oriented programming languages is the ability to design abstract data types . Briefly explain the difference between an abstract data type and a primitive data type . |
[2] |
(b) |
You are required to implement a Queue
abstract data type. (i)Define a class,Queue
,which contains the following member variables:
(iii)Write a method,called PeekHead
,the signature of which is given below,which is a member of your Queue
class.The method should return the data element at the front of the
queue,without removing the element,and return zero if the queue is
empty. (iv)Write a method,called Add ,the signature
of which is given below,which is a member of your Queue class.The
method should add the element x to the Back of the queue if there
is space,whilst ensuring that the Back iterator is correctly positioned.You
should assume that there will always be space in the array for the
element to be added.[4 marks ] |
[13] |