Computer Science 255 Third Hour Exam Name ______________________ Monday, Nov. 26 100 pts. 1. (15 pts.) List and briefly describe the three main file organizations, paying particular attention to the ways in which records may be accessed. 2. (15 pts.) List and briefly describe the five steps in the life- cycle model for software development. 3. (30 pts.) Records in the file MASTER.DAT have the following organization: 01 MASTER-REC. 02 PNO PIC X(5). 02 PNAME PIC X(20) 02 AMT-ON-HAND PIC 999. The file TRANS.DAT contains variable length records for insertion and deletion only (with only one transaction / part number). Each record contains a part number (PNO) followed by a transaction code (PIC X) containing a "D" for deletion transactions and an "I" for insert transactions. a. (10 pts.) Write the variable length file (FD) description for this file. b. (20 pts.) Write the PROCEDURE DIVISION entries (only) to read MASTER.DAT and TRANS.DAT and create a new master file, processing insertions and deletions in TRANS.DAT. Check for out of sequence conditions, for the attempted insertion of an existing record, and for the attempted deletion of a non-existent record. Assume reasonable variable names (i.e., you do not need to write the DATA DIVISION entries, and announce errors with a suitable DISPLAY statement (i.e., you do not need an error listing file). 4. (10 pts.) Assume the following sequence of keys in a file. File A: 10 / 30 / 20 / 50 / 60 / 5 / 25 / 35 / 15 / 40 a. What is the arrangement of keys in files B and C in a distribution-merge sort? File B: File C: b. What is the arrangement of keys after a merge back into file A in a distribution merge-sort? File A: 5. (10 pts.) What is the impedance mismatch problem with the COBOL SORT verb, and how does COBOL get around it? 6. (20 pts.) The table PNO-TABLE contains 30 part records as follows: 02 PNO PIC X(5). 02 PNAME PIC X(20) 02 AMT-ON-HAND PIC 999. The table is sorted in ascending order by part number. a. (5 pts.) Write the COBOL description for this table, setting it up for a binary search (note that this is a repeat of a question in the last exam). b. (15 pts.) Write the COBOL SEARCH verb which will look for the part record with PNO = "12345", DISPLAYing a message if the part is not found, and the name of the part if it is found. Page