CSCI 465 Name _____________________ Summer, 2009 Quiz 7 (10 points) On multiple choice questions, pick the best available answer. True-false questions are 1 point each; the rest are 2 points each. Other problems are worth points as marked. 1. In a control-break program, we need to have data that has been sorted on several key fields. *** A. True B. False 2. When we define an indexed table in COBOL, we do not need to declare the index separately somewhere in Working-Storage. *** A. True B. False 3. Suppose I want to do a binary search on a table in COBOL. Which statement is not true? A. The table must be indexed. B. The table must be declared with the clause ?Ascending key is _____? or ?Descending Key is _____?. C. The data must be sorted. D. We use the Search All operation. *** E. Before the search, the index must be set to 1. 4. In COBOL, we are always prevented from going past the end of a table. A. True *** B. False 5. If we have an ?At end? clause on a READ statement in COBOL, we need to end the statement with End-Read or with a period. *** A. True B. False 6. (2 point) Suppose I have a variable in COBOL declared as 01 Net-Value Pic S9(7)V99. I would like to move it to a field called Neat-Net-Value which is part of a detail line. When the number is printed, I want it to have: leading zeroes suppressed, a real decimal point and commas separating groups of 3 digits. If the number is negative, there should be a minus sign immediately before the first digit printed. If the number is not negative, there is no need to print the sign. Write the Pic clause for Neat-Net-Value. Answer: --,---,--Z.99 Or perhaps --,---,---.99 7. (2 points) Suppose I define a table in COBOL as follows: 01 Q-Table. 05 Customer Occurs 250 times. 10 Cust-ID Pic X(8). 10 Cust-Date. 15 Cust-DD Pic 99. 15 Cust-MM Pic 99. 15 Cust-YYYY Pic 9(4). 10 Cust-Balance Pic S9(6)V99. 10 Cust-Email Pic X(40). 10 Cust-Status Pic XXXX. How many bytes are used to store Q-Table? Show your calculation. Answer: 250 * (8 + 2 + 2 + 4 + 8 + 40 + 4) = 250 * 68 = 17000