You are on page 1of 4
\ ‘THE UNIVERSITY OF THE WEST INDIES ST. AUGUSTINE, EXAMINATIONS OF April/May 2019 Code and Name of Course: COMP0200 ~ N1 Computer Science IL Date and Time Wedrerler path Mow 2nt4 INSTRUCTIONS TO CANDIDATES: This paper has 3 pages and 4 questions © The University of the West Indies Answer ALL Questions Questions are not evenly weighted. Course Code COMP 0200 Duration: 2 Hours 2018/2019 Sem II Page 2 1. a) A queue is implemented using an array. The diagram below shows the contents of the queue and the location of the front and rear pointers. Cle Tet pase aes @itwimMfolc/[ripis[F 7 T Front, Rear ie For each of the following, draw a diagram showing the contents of the queue and the location of front and rear in the queue as each action is done one after the other. 4) afler the letters L and Y are inserted ii) after three letters are removed iii) after the letters B and Z are inserted {7 marks} b) You are given a Stack sfk, with a set of integer elements, Write code to remove the last element from the Stack. The remaining elements on the Stack are left in reverse order. For example, if the stack contains 1, 2, 3, 4 with 1 at the top and 4 at the bottom of the stack, when 4 is removed the contents of the stack will be 3, 2, 1 Top > Reverse order s)u)r|e Remove > Assume that only the following functions are available: For manipulating a Stack: pop (stk), push (stk, data), isEmpty (stk) For manipulating a Queue: enqueue (q, data), dequeue (q), isEmpty (q) [11 marks] ‘Total marks: 18 2. a) Write a function isearch, which accepts the following parameters: arr, an unsorted array of integers rn, the amount of elements in arr, and key, the integer being searched for and performs a linear search on arr for key. If key is found, your function should return the location in the array arr, where it was found. Otherwise, it should return -1 [7 marks] Question 2 continues on the next page. © The University of the West Indies Course Code COMP 0200 2018/2019 Sem It ») 3. a) » b) e) ad A sorted integer array contains the following values: OUTST eae he wy eo 22} 25133 | 46 | 5055 | 69 | 70| 74 | 80 | 86 A binary search is used to search for the value 69 in the array. How many comparisons will be made before it is found? Show your working, (3 marks] ‘Total marks: 10 ‘When regular customers call Red Tomato their phone number goes automatically into the order system. The phone number causes customer information to automatically come up on the screen, Once the order is taken, the cost of the order including delivery, is calculated, The order is then given to the chef, A receipt is printed, Drivers who make deliveries give customers a copy of the receipt. Weekly reports are generated for management. Draw a context diagram that depicts the flow of information amongst the customer, pizza order system and other entities in the above scenario, [9 marks] List three (3) characteristics of a well-engineered software product. {3 marks) ‘Total marks: 12 ‘What is a network protocol? [1 mark] Distinguish between a MAN (metropolitan area network) and a WAN (Wide Area Network). [2 marks] How is the cable used for providing cable television able to cary so many television signals? [2 marks] How is data transmitted on a bus network? (2 marks] With the aid of a diagram, explain how data is transmitted in a ring network. [3 marks] List the five (5) layers of the Internet protocol stack in order from the lowest layer to the highest Jayer, [5 marks] ‘Total marks: 15 ‘Total marks: 5S End of Examination © The University of the West Indies Course Code COMP 0200 2018/2019 Sem II

You might also like