COMP0200 N1 Computer Science II 2021/2022 Semester 2 Coursework Test 2 (40%) TIME: Submit within 8 hours starting from 12PM, April 7th This paper contains 6 pages and 3 sections and 6 questions. Answer all questions in all Sections. Instructions General Guidelines 1. All code written must be individual original work or can be code from lectures (with acknowledgement). 2. Write all code in C++ 3. The solution to each programming question is to be uploaded separately. Do not zip any file. 4. Each student must submit his/her own work and no communication is allowed among students 5. All functions must have supporting code e.g. main() to ensure that they run and give output 6. It is expected that each solution file e.g. Qx.cpp, is done similar to an assignment, in that when it is executed, it should give output that proves it works correctly. 7. Programs with syntax errors or logic errors will earn 0 or very low marks. 8. Reasonable assumptions are allowed 9. Failure to follow all instructions may result in deduction of marks 10. No files will be accepted after CW deadline reached. If special late window is used, penalties may apply. 11. Email Michael.Hosein@sta.uwi.edu if you have any queries. Include the question and question number in your email. 12. For questions with diagrams-diagrams can be hand-drawn and inserted as pictures in your response files or they can be drawn electronically. Drawing the diagram by hand and then taking a clear picture would save a lot of time. All pictures must be inserted in the correct part of the question in your script. 13. Accepted TurnItIn similarity index is 15% approx. Section 1-Programming ANSWER ALL QUESTIONS Instructions • All functions must have supporting code e.g. main() to ensure that they run and give output • If arrays, stacks, queues are mentioned in this paper in this paper and no size is implied, use a size of 100. • If stacks and queues appear in this exam, then all supporting functions must be included. You cannot use include <stack>, <queue> etc. 1. The name of the source file for this question is Q1.cpp You are to write one program only, with all the functionality for this question. Place your ID number at the top of the source file. • Create a stack, stack1, with the integers from 40 to 50 inclusive. (50 must be at the top of the stack and the integers are 40,41,42..49,50) • Create a queue of integers, queue1 • Pop stack1 and for each integer, x1, popped from the stack, if x1 is odd, enqueue f(x1) to the queue. Also, print each value popped from stack1. Function f is given below: f(x) =3x+3 E.g. if 41 is popped from the stack, then f(41) is enqueued. • Next, dequeue the values from the queue and find the sum of the first 3 values dequeued. Print each value that was dequeued as well as the sum of the first 3 values to the screen. [20] 2. The name of the source file for this question is Q2.cpp You are to write one program only, with all the functionality for this question. Place your ID number at the top of the source file. Write programming code for all of the following. All output is to be sent to the screen. All output must be properly labelled. a. Store the following set of integers in an array arr1 (hard-code the array). Array arr1 contents are given below, starting from location 0 of the array. 10 20 30 40 44 46 48 50 99 101 b. Print the number of iterations (or passes) needed for 99 to be found using the following search techniques: i. Linear search ii. Binary search c. Next, reverse and print the array contents. No additional array must be used. Print the 8th element of the reversed array as well [on a line by itself]. d. Store the following integers in a new array, arr2, starting from location 0. 4 20 1 10 8 3 22 15 42 5 Code and run a selection sort on arr2, so that the values are sorted in descending order and print the sorted array. Print all the values on one line separated by a space (or a tab) [20] End of Section 1 TOTAL FOR SECTION 1: 40 MARKS Section 2-Software Engineering ANSWER ALL QUESTIONS Place the solutions for Questions 3 and 4 in a single Word file called <ID>Section 2 and upload The word limit for each part is 250 words 3. (a) Explain why software integration is important when developing software. [2 marks] (b) Describe ONE (1) advantage and ONE(1) disadvantage when developing software with the waterfall model. (c) [4 marks] A large supermarket chain needs a point of sale (POS) system to check out grocery items. [4 marks] Describe (i) TWO functional requirements of the system (ii) TWO non-functional requirements of the system (d) Why is domain analysis important in software engineering? (e) Explain TWO advantages of software requirement validation for an insurance company acquiring new software. [1 mark] [4 marks] TOTAL 15 MARKS 4. (a) TDS wants to install a system to record orders for items to be shipped. When regular customers bring in an item to a retail centre for shipping their phone number is entered into the system. The phone number invokes the customer’s name, address and last order date automatically on the screen. Once the shipping order is taken the total, including tax and delivery charge is calculated. The order is then sent to the shopping area. A receipt is printed. If it is a new customer, the relevant information is recorded and stored. Occasionally, special offers (coupons) are printed so the customer can get a discount. Drivers who make deliveries give customers a copy of the receipt and coupon (if any). Weekly totals are kept for comparison with last year’s performance. Draw a Level 1 diagram to represent the flow of data through the proposed system. [8 marks] (b) Draw an entity-relationship diagram (ERD) based on the description below. A sales rep may serve many customers but some customers are not allocated to a sales rep. A customer can also only be serviced by one sales rep. Each customer places at least one order. Each order contains at least one product. Products are stored in warehouses. A given warehouse can store many products but that warehouse may not stock certain products. [7 marks] TOTAL 15 MARKS End of Section 2 TOTAL FOR SECTION 2: 30 MARKS Section 3-Operating Systems and Computer Networks ANSWER ALL QUESTIONS The word limit for each part is 250 words e.g. 5(a)-250 words, 5(b)-250 words etc. Place the solutions for Questions 5 and 6 in a single Word file called <ID>Section 3 and upload 5. (a) Describe two MAIN components of the ‘nuts and bolts’ view of the Internet. Be sure to give the functionality of each component. [5] (b) Why is an RFID-based system better than an infrared system when tracking inventory in a warehouse? Explain. [4] (c) Briefly describe each of the following with an example of each. i. ii. iii. [6] Simplex transmission Half-duplex transmission Full-duplex transmission TOTAL 15 marks 6. (a) (b) A process p1 is currently running an instruction prog1. It is necessary to run another process p2 for a few seconds and then return to p1. Explain how the operating system facilitates this. Include at least one diagram. [6] Describe how an operating system is assisted in its functioning when each of the following is used: [6] (i) Device driver (ii) Bootstrap program (iii) Virtual memory (c) Describe a scenario where virtual processors can be used to enhance performance. [3] TOTAL 15 marks End of Section 3 TOTAL FOR SECTION 3: 30 MARKS End of Examination (Total 100 marks)