April 2000 QUESTION 5 Total Marks: 15 Marks |
Click here to access other
questions
SUGGESTED SOLUTIONS |
Do not award half marks. Do not deduct marks for trivial syntactic errors. Alternative correct answers should be given credit, unless otherwise indicated in the marking scheme. When an aeroplane approaches a certain
airport,a record is entered in a queue which contain the right registration
number,which is a string of up to ten characters,an arrival number,which
si an integer indicating the order in which aeroplanes arrived in
the airport, and a landing priority,which can be one of urgent,normal
or low. (a)Briefly explain what i meant by a
queue data structure.[2 marks ] Give a suitable type declaration for
the LandingPriority type described above,such that variables of this
type can have any one of the values urgent normal or low [1 mark ] (c)Give a definition of a data tructure
called FlightArrival which holds all of the (d)Give a definition of a data tructure
which can be used to implement a dynamic queue of FlightArrival structures.[3
marks ] (e)Write a function,called PeekNextLanding the signature of which is given below, which takes a queue q and returns a copy of the first FlightArrival in q which has a urgent landing priority,or the first element in the queue should there not be an element with this priority.You may assume standard queue manipulation routines, and the function should not remove the element from the queue. FUNCTION PeekNextLanding(q : Queue)
: FlightArrival; |