CHAPTER 4 PART A:
T F 1. Instructions in the PROCEDURE DIVISION define and produce data items associated with output information.
T F 2. A name which has been used to identify a field may also be used to identify a paragraph because a compiler can distinguish between the two uses.
T F 3. A sentence in the PROCEDURE DIVISION consists of one or more statements.
T F 4. COBOL statements that end with a period are called sentences.
T F 5. Coding the main module prior to coding any lower level program modules is referred to as the top-down approach.
T F 6. The OPEN statement accesses a file and uses the RECORD CONTAINS clause, if specified, in the DATA DIVISION to check for the specified length of each record.
T F 7. The PERFORM UNTIL ... END-PERFORM statement is called an in-line PERFORM.
T F 8. When reading from a file sequentially, the READ statement must include an AT END clause.
T F 9. The AT END clause of a READ statement typically moves the value
'NO ' to the field ARE-THERE-MORE-RECORDS.
____ 10. The PROCEDURE DIVISION contains input/output and _______________ statements.
A) data
B) FD descriptions
C) SELECT
D) processing
E) none of the above.
____ 11. Paragraph names can be formed
A) using the same rules used for forming data names.
B) using all digits if necessary.
C) with a name identical to a data name.
D) both A and B above.
E) none of the above.
____ 12. The NOT AT END clause is used in a READ statement
A) to process an input record.
B) to check for an end-of-file condition.
C) to terminate execution of the READ statement.
D) all of the above.
E) none of the above.
____ 13. End-of-job processing in COBOL programs require
A) the use of the STOP RUN statement.
B) that all files be closed with the CLOSE statement.
C) the CLOSE statement to be coded before the STOP RUN statement in all versions of COBOL.
D) a STOP RUN statement to be coded before the CLOSE statement in all versions of COBOL.
E) none of the above.
____ 14. A COBOL program reads ___________ names and writes ____________ names.
A) file, record
B) record, output
C) data, file
D) record, file
E) none of the above.
____ 15. If there are 100 records to be read, the AT END clause will be executed on the
A) 101st attempt to read.
B) 100th attempt to read.
C) 99th attempt to read.
D) 1st attempt to read since the AT END clause in only an optional clause used with READ statement accessing sequential files.
E) none of the above.
CHAPTER 4 PART B:
1. A(n) input file contains an unspecified number of records each having 50 characters of data. Data from each input record are to be copied to an output record (suitable for later printing) and written to a(n) output file. The output record contains a ten character field containing spaces followed by a six digit line-number (determined from the processing) followed by a single space followed by the characters from the input record. Code the following using ANS COBOL 74 standards:
a. The complete DATA DIVISION including the FD and record entries for the necessary files and the required WORKING-STORAGE SECTION entries.
b. The PROCEDURE DIVISION to include a main module and a processing module which increments the line number to count the number of data records and perform the necessary input and output operations.
____ 2. The PROCEDURE DIVISION contains input/output and _______________ statements.
A) data
B) FD descriptions
C) SELECT
D) processing
E) none of the above.
____ 3. Paragraph names can be formed
A) using the same rules used for forming data names.
B) using all digits if necessary.
C) with a name identical to a data name.
D) both A and B above.
E) none of the above.
____ 4. In the COBOL language, standard instruction format specification rules indicate that
A) underlined words are optional in the statement or option specified.
B) punctuation, even though included in the format, is optional.
C) braces denote that any one of the enclosed items is optional.
D) brackets [ ] denote that an enclosed item is required.
E) none of the above.
____ 5. The functions of the OPEN statement include
A) accessing specified hardware devices.
B) making files available for processing.
C) creating a header label on the specified output file if label records are specified as STANDARD.
D) designates a file as either input or output.
E) all of the above.
____ 6. When coding the OPEN statement each file should appear on a separate line. Following this guideline will
A) make debugging easier.
B) make the program easier to read.
C) ensure that files are opened in the order in which they are used in the program.
D) both A and B above.
E) none of the above.
____ 7. When using the PERFORM UNTIL ... statement
A) statements within the loop will be executed at least one time.
B) the END-PERFORM clause is required in COBOL 74.
C) control returns to the statement immediately following the end of the PERFORM statement.
D) control is transferred to another paragraph where a series of statements will be executed one time.
E) none of the above.
____ 8. The file name which appears in a READ statement must have appeared for the first time in the program previously in
A) an FD entry.
B) an OPEN statement.
C) a SELECT statement.
D) the IDENTIFICATION DIVISION.
E) none of the above.
____ 9. The NOT AT END clause is used in a READ statement
A) to process an input record.
B) to check for an end-of-file condition.
C) to terminate execution of the READ statement.
D) all of the above.
E) none of the above.
____ 10. The typical main module of a COBOL 74 program differs from the main module in a COBOL 85 program because
A) COBOL 74 does not have a standard in-line PERFORM UNTIL ... statement.
B) COBOL 85 does not have an END-READ scope terminator.
C) COBOL 74 does not have a simple PERFORM statement.
D) COBOL 74 can not input the first record in the main module.
E) none of the above.
____ 11. If there are 100 records to be read, the AT END clause will be executed on the
A) 101st attempt to read.
B) 100th attempt to read.
C) 99th attempt to read.
D) 1st attempt to read since the AT END clause in only an optional clause used with READ statement accessing sequential files.
E) none of the above.