47
++++++++++++++++++++++ Set-1 ++++++++++++++++++++++ Sample Code EVALUATE A * B WHEN 175 EVALUATE C + D WHEN 234 PERFORM 234-ROUTINE WHEN 432 PERFORM 432-ROUTINE WHEN OTHER PERFORM NOT-234-ROUTINE END-EVALUATE WHEN NOT 232 PERFORM NOT-232-ROUTINE WHEN OTHER PERFORM NOT-175-ROUTINE END-EVALUATE. Assume A = 25, B = 7, C = 186, and D = 48. Which one of the following paragraphs is performed as a result of the above sample code? Choice 1 NOT-175-ROUTINE Choice 2 NOT-232-ROUTINE Choice 3 NOT-234-ROUTINE Choice 4 234-ROUTINE Choice 5 432-ROUTINE COBOL II, Question 1 of 40 --------------------------------------------- ----------------- Scenario 0100 INITIAL-READ. 0110 READ MASTER-FILE 0120 AT END MOVE 'Y' TO MASTER-EOF-SW. 0130 PERFORM PROCESS-FILE 0140 UNTIL END-OF-TRANSACTIONS. 0150 GOBACK. 0160 PROCESS-FILE. 0170 READ TRANSACTION-FILE 0180 AT END MOVE 'Y' TO TRANSACTION- EOF-SW 0190 NOT AT END PERFORM PROCESS-A- RECORD. 0200 PROCESS-A-RECORD. 0210 IF TRANSACTION-KEY < PREVIOUS-KEY 0220 DISPLAY '??????' 0230 ELSE 0240 MOVE TRANSACTION-KEY TO PREVIOUS- KEY 0250 PERFORM UNTIL MASTER-KEY >= TRANSACTION-KEY 0260 READ MASTER-FILE 0270 AT END MOVE 'Y' TO MASTER-EOF-SW 0280 END-READ 0290 END-PERFORM 0300 IF MASTER-KEY = TRANSACTION-KEY 0310 MOVE TRANSACTION-RECORD TO MASTER-RECORD 0320 REWRITE MASTER-RECORD 0330 ELSE 0340 DISPLAY '??????' 0350 END-IF 0360 END-IF. The scenario above presents a simple master-transaction update program segment. Assume both files have been sorted into ascending sequence by the respective key fields. Referring to statement #0340, which one of the following errors has been detected? Choice 1 The transaction file is out of sequence. Choice 2 The master file is out of sequence. Choice 3 There is no corresponding transaction record for the master being processed. Choice 4 There is no corresponding master record for the transaction record being processed. Choice 5 A logic error has occurred. COBOL II, Question 2 of 40 Sample Code DATA DIVISION. WORKING-STORAGE SECTION. 01 AFIELD PIC S9(3) COMP-3 VALUE +996. 1

COBOL Brainbench(Set1 2 3 4)

Embed Size (px)

DESCRIPTION

mok

Citation preview

Page 1: COBOL Brainbench(Set1 2 3 4)

++++++++++++++++++++++Set-1++++++++++++++++++++++Sample Code EVALUATE A * B WHEN 175 EVALUATE C + D WHEN 234 PERFORM 234-ROUTINE WHEN 432 PERFORM 432-ROUTINE WHEN OTHER PERFORM NOT-234-ROUTINE END-EVALUATE WHEN NOT 232 PERFORM NOT-232-ROUTINE WHEN OTHER PERFORM NOT-175-ROUTINE END-EVALUATE. Assume A = 25, B = 7, C = 186, and D = 48. Which one of the following paragraphs is performed as a result of the above sample code? Choice 1 NOT-175-ROUTINE Choice 2 NOT-232-ROUTINE Choice 3 NOT-234-ROUTINE Choice 4 234-ROUTINE Choice 5 432-ROUTINE COBOL II, Question 1 of 40 --------------------------------------------------------------

Scenario 0100 INITIAL-READ. 0110 READ MASTER-FILE 0120 AT END MOVE 'Y' TO MASTER-EOF-SW. 0130 PERFORM PROCESS-FILE 0140 UNTIL END-OF-TRANSACTIONS. 0150 GOBACK. 0160 PROCESS-FILE. 0170 READ TRANSACTION-FILE 0180 AT END MOVE 'Y' TO TRANSACTION-EOF-SW 0190 NOT AT END PERFORM PROCESS-A-RECORD. 0200 PROCESS-A-RECORD. 0210 IF TRANSACTION-KEY < PREVIOUS-KEY 0220 DISPLAY '??????' 0230 ELSE 0240 MOVE TRANSACTION-KEY TO PREVIOUS-KEY 0250 PERFORM UNTIL MASTER-KEY >= TRANSACTION-KEY 0260 READ MASTER-FILE

0270 AT END MOVE 'Y' TO MASTER-EOF-SW 0280 END-READ 0290 END-PERFORM 0300 IF MASTER-KEY = TRANSACTION-KEY 0310 MOVE TRANSACTION-RECORD TO MASTER-RECORD 0320 REWRITE MASTER-RECORD 0330 ELSE 0340 DISPLAY '??????' 0350 END-IF 0360 END-IF. The scenario above presents a simple master-transaction update program segment. Assume both files have been sorted into ascending sequence by the respective key fields. Referring to statement #0340, which one of the following errors has been detected?

Choice 1 The transaction file is out of sequence. Choice 2 The master file is out of sequence. Choice 3 There is no corresponding transaction record for the master being processed. Choice 4 There is no corresponding master record for the transaction record being processed. Choice 5 A logic error has occurred. COBOL II, Question 2 of 40

Sample Code DATA DIVISION. WORKING-STORAGE SECTION. 01 AFIELD PIC S9(3) COMP-3 VALUE +996. 01 BFIELD PIC S9(3) COMP-3 VALUE +117. PROCEDURE DIVISION. ADD AFIELD TO BFIELD. DISPLAY BFIELD. Which one of the following values is displayed as a result of the DISPLAY statement in the sample code above? Choice 1 +013 Choice 2 +113 Choice 3 +114 Choice 4 +1013 Choice 5 +1113 COBOL II, Question 3 of 40

Sample Code DATA DIVISION. WORKING-STORAGE SECTION.

1

Page 2: COBOL Brainbench(Set1 2 3 4)

01 AFIELD PIC S9(3) COMP-3 VALUE +020. 01 BFIELD PIC S9(3) COMP-3 VALUE +5. PROCEDURE DIVISION. DIVIDE AFIELD BY BFIELD GIVING BFIELD. DISPLAY BFIELD. Which one of the following values is displayed by the DISPLAY statement in the sample code above? Choice 1 +0 Choice 2 +1 Choice 3 +4 Choice 4 +6 Choice 5 +8 COBOL II, Question 4 of 40

Sample Code 01 NICKNAME PIC X(11). 01 DATA-FIELDS. 05 FLDA PIC X(11) VALUE 'SNOOKIEPOOH'. 05 FLDB PIC X(11) VALUE 'SNOOKIEbbbb'. 05 FLDC PIC X(11) VALUE 'WOOKIEbbbbb'. 05 FLDD PIC X(11) VALUE 'WICKIEWOCKb' ... MOVE FUNCTION MAX(FLDC FLDA FLDB FLDD) TO NICKNAME (1:11). Which one of the following values is contained in NICKNAME following execution of the MOVE statement in the sample code above?

Note: the character 'b' represents a blank. Choice 1 SNOOKIEbbbb Choice 2 WICKIEWOCKb Choice 3 WOOKIEbbbbb Choice 4 SNOOKIEPOOH Choice 5 WOOKbbbbbbb COBOL II, Question 5 of 40

Sample Code 0100 IF EMPLOYEE-CLASS = '01' 0200 IF EMPLOYEE-TYPE = 'SE' 0300 IF EMPLOYEE-AGE > 50 0400 PERFORM PERFORM BONUS-APPLICATION 0500 END-IF 0600 ELSE 0700 PERFORM SPECIAL-EMPLOYEE 0800 END-IF 0900 PERFORM SPECIAL-CLASS 1000 END-IF. 1100 PERFORM NEXT-TASK. In the sample code above, if

employee-class = '01' and employee-type = 'SE' and employee-age = 50;

which one of the following statements is executed? Choice 1 0400 Choice 2 0600 Choice 3 0700 Choice 4 0900 Choice 5 1200 COBOL II, Question 6 of 40

Sample Code CALL 'PROGRAMA' USING FIELDA, FIELDB, FIELDC. Referring to the sample code above, the CALLED program must have a PROCEDURE DIVISION header as shown in which one of the following? Choice 1 PROCEDURE DIVISION RECEIVING FIELDA, FIELDB, FIELDC. Choice 2 PROCEDURE DIVISION USAGE IS FIELDA, FIELDB, FIELDC. Choice 3 PROCEDURE DIVISION INCOMING FIELDA, FIELDB, FIELDC. Choice 4 PROCEDURE DIVISION USING FIELDC, FIELDB, FIELDA. Choice 5 PROCEDURE DIVISION USING FIELDA, FIELDB, FIELDC. COBOL II, Question 7 of 40

Field Definitions W-TOTAL-AMT = total amount from all records W-NUM-RECS = total number of records W-AVG-AMT = average amount per record Using the field definitions above, which one of the following correctly computes the average amount per record? Choice 1 W-TOTAL-AMT / W-NUM-RECS = W-AVG-AMT. Choice 2 DIVIDE W-TOTAL-AMT BY W-NUM-RECS GIVING W-AVG-AMT. Choice 3 W-TOTAL-AMT DIVIDED BY W-NUM-RECS EQUALS W-AVG-AMT. Choice 4 DIVIDE W-AVG-AMT INTO W-TOTAL-AMT. Choice 5

2

Page 3: COBOL Brainbench(Set1 2 3 4)

DIVIDE W-TOTAL-AMT INTO W-NUM-RECS GIVING W-AVG-AMT. COBOL II, Question 8 of 40

Sample Code 01 FIELD1 PIC 9(5) VALUE -123. 01 FIELD2 PIC S99 VALUE -12. 01 FIELD3 PIC S99 VALUE 99. Which one of the following is the reason the sample code above is INCORRECT? Choice 1 The VALUE clause for FIELD2 is not matched with the PICTURE clause. Choice 2 The VALUE clause and the PICTURE clause must match usage. Choice 3 The VALUE clause for FIELD3 is unsigned and the PICTURE clause is signed. Choice 4 The VALUE clause for FIELD2 is signed and the PICTURE clause is signed. Choice 5 The VALUE clause for FIELD1 is signed and the PICTURE clause is unsigned. COBOL II, Question 9 of 40

Which one of the following sets of sections is used in the Data Division? Choice 1 Configuration File Working-Storage Linkage Choice 2 File Working-Storage Communication Linkage Choice 3 File Working-Storage External-Storage Reporting Choice 4 File Working-Storage Linkage Report Choice 5 I-O File Working-Storage Linkage COBOL II, Question 10 of 40

INITIALIZE has NO effect on which one of the following types of fields? Choice 1 PIC 9(..) Choice 2 PIC S9(..) COMP-3 Choice 3 FILLER or index items Choice 4 PIC S9(..) Choice 5 PIC ZZ,ZZ9.99 COBOL II, Question 11 of 40

Which one of the following is the implicit scope terminator that ends the scope of any statement NOT explicitly terminated? Choice 1 Period Choice 2 END-READ Choice 3 END-PERFORM Choice 4 END-IF Choice 5 END-EVALUATE COBOL II, Question 12 of 40

Sample Code 0100 IDENTIFICATION DIVISION. 0200 PROGRAM-ID. AM822P115. Which one of the following is INCORRECT in the sample code above? Choice 1 There should not be a hyphen between PROGRAM and ID. Choice 2 ID should not be capitalized. Choice 3 The program name is too long. Choice 4 Line 0200 is not a valid statement. Choice 5 Line 0200 should be Program Identification. AM8220115. COBOL II, Question 13 of 40

Sample Code WORKING-STORAGE SECTION. 01 ZZ-TOP PIC S9 COMP-3 VALUE +9.

PROCEDURE DIVISION.

...

ADD +1 TO ZZ-TOP.

3

Page 4: COBOL Brainbench(Set1 2 3 4)

... Which one of the following is the value of ZZ-TOP after execution of the ADD instruction shown in the sample code above? Choice 1 +4 Choice 2 +5 Choice 3 +10 Choice 4 Unpredictable Choice 5 Zero COBOL II, Question 14 of 40

Sample Code DATA DIVISION. WORKING-STORAGE SECTION. 01 DATA-ARRAY. 05 DATA-FIELD OCCURS 10 TIMES PIC S9(3) COMP-3. PROCEDURE DIVISION. MOVE ZEROS TO DATA-ARRAY. ADD +1 TO DATA-FIELD (9). When executed, the sample code above results in which one of the following, exception codes? Choice 1 Operation exception Choice 2 Boundary Violation Exception Choice 3 Decimal divide exception Choice 4 Protection exception Choice 5 Data exception COBOL II, Question 15 of 40

Which one of the following sets of sections are found in the Environment Division? Choice 1 Data Section and Procedure Section Choice 2 File Section and Data Definition Storage Section Choice 3 Communication Section and File Section Choice 4 Configuration Section and Input-Output Section Choice 5 Configuration Section and Data Section COBOL II, Question 16 of 40

Sample Code Layout of library member IRECORD: 01 INPUT-RECORD. 05 INPUT-LAST-NAME PIC X(20). 05 INPUT-FIRST-NAME PIC X(10). 05 INPUT-TELENO PIC X(10). Referring to the sample code above, which one of the following is the correct sequence of instructions that will cause IRECORD to be copied into the program? Choice 1 FD INPUT-FILE. 01 COPY IRECORD. Choice 2 FD INPUT-FILE COPY IRECORD. Choice 3 FD INPUT-FILE. COPY IRECORD. Choice 4 FD INPUT-FILE. COPY MEMBER IRECORD. Choice 5 FD INPUT-FILE. COPY I-RECORD. COBOL II, Question 17 of 40

Scenario WORKING-STORAGE SECTION. 01 STATE-CODE PIC XX. 88 CALIFORNIA VALUE 'CA'. 88 COLORADO VALUE 'CO'. 88 CONNECTICUT VALUE 'CT'. 01 STATE-NAME PIC X(20).

PROCEDURE DIVISION.

EVALUATE TRUE WHEN CALIFORNIA MOVE 'CALIFORNIA' TO STATE-NAME WHEN COLORADO MOVE 'COLORADO' TO STATE-NAME WHEN CONNECTICUT MOVE 'CONNECTICUT' TO STATE-NAME WHEN OTHER MOVE 'NO STATE NAME FOUND' TO STATE-NAME END-EVALUATE. Assume a value of TN is stored in the field STATE-CODE. Which one of the following logic errors, if any, is embedded in the scenario above? Choice 1 The scenario will abend. Choice 2 The scenario will not execute efficiently. Choice 3 An IF statement should be used. Choice 4

4

Page 5: COBOL Brainbench(Set1 2 3 4)

The scenario will execute with no problems. Choice 5 The scenario assumes there are only three possible values for STATE-CODE. COBOL II, Question 18 of 40

Sample Code 05 W-CLASS-GRADE PIC X(01). 88 W-GRADE-EXCELLENT VALUE 'A'. 88 W-GRADE-GOOD VALUE 'B'. 88 W-GRADE-AVG VALUE 'C'. 88 W-GRADE-POOR VALUE 'D'. 88 W-GRADE-FAIL VALUE 'F'.

S0400-VERIFY-GRADE IF W-GRADE-EXCELLENT MOVE C-EXCELLENT-WORK TO W-COMMENT ELSE IF W-GRADE-GOOD MOVE C-GOOD-WORK TO W-COMMENT ELSE MOVE C-NO-COMMENT TO W-COMMENT END-IF. Referring to the above Working Storage field and sample code, which one of the following errors, if any, occurs in the sample code? Choice 1 All '88 levels that were defined must be used in the IF statement. Choice 2 Grades 'C', 'D', and 'F' all fall into the "no comment" range. Choice 3 TRUE or FALSE should be used on the IF statements. Choice 4 Relational operators cannot be used when a data name is used for the IF statement. Choice 5 The statement does not contain any errors. COBOL II, Question 19 of 40

Which one of the following statements causes a header line to be written at the top of a new page of a report? Choice 1 WRITE RPT-RCD FROM RPT-HEADER Choice 2 WRITE RPT-RCD FROM RPT-HEADER BEFORE ADVANCING PAGE Choice 3 WRITE RPT-RCD FROM RPT-HEADER AFTER ADVANCING PAGE Choice 4

ADVANCE RPT-FILE PAGE WRITE RPT-HEADER Choice 5 WRITE RPT-RCD AFTER ADVANCING FROM RPT-HEADER COBOL II, Question 20 of 40

Sample Code WORKING-STORAGE SECTION. 01 S04-RECORD. 05 S04-MBN PIC X(4). 88 S04-SPECIAL-CUSTOMER VALUE '1234'. 88 S04-REGULAR-CUSTOMER VALUE '5678'.

PROCEDURE DIVISION.

IF S04-SPECIAL-CUSTOMER PERFORM HANDLE-SPECIAL-CUSTOMER END-IF. IF S04-REGULAR-CUSTOMER PERFORM HANDLE-REGULAR-CUSTOMER END-IF. Which one of the following statements is equivalent to the sample code shown above? Choice 1 EVALUATE S04-MBN WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. Choice 2 EVALUATE TRUE ALSO TRUE WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. Choice 3 EVALUATE TRUE WHEN S04-REGULAR-CUSTOMER PERFORM HANDLE-REGULAR-CUSTOMER WHEN S04-SPECIAL-CUSTOMER PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. Choice 4 EVALUATE S04-MBN = TRUE WHEN '1234' PERFORM HANDLE-SPECIAL-CUSTOMER WHEN '5678' PERFORM HANDLE-REGULAR-CUSTOMER END-EVALUATE. Choice 5 EVALUATE S04-MBN ALSO S04-MBN WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678'

5

Page 6: COBOL Brainbench(Set1 2 3 4)

PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. COBOL II, Question 21 of 40

Which one of the following contains the four DIVISIONS used in COBOL? Choice 1 Identification Environment Data Procedure Choice 2 Identification Environment Working-Storage Procedure Choice 3 Identification Input-Output Data Procedural Choice 4 Identification Data Linkage Procedure Choice 5 Identification Configuration Working Storage Procedure COBOL II, Question 22 of 40

Sample Code IF I-PLAYER-POSITION = '1' ADD 1 TO A-PITCHER-COUNT ELSE IF I-PLAYER-POSITION = '2' ADD 1 TO A-CATCHER-COUNT ELSE IF I-PLAYER-POSITION = '3' ADD 1 TO A-FIRST-COUNT ELSE IF I-PLAYER-POSITION = '4' ADD 1 TO A-SECOND-COUNT ELSE IF I-PLAYER-POSITION = '5' ADD 1 TO A-THIRD-COUNT END-IF END-IF END-IF END-IF

END-IF. Which one of the following Working Storage fields is used in an EVALUATE statement to replace the IF/ELSE logic in the sample code above? Choice 1 05 W-PLAYER-POSITION PIC X(01). 88 W-PITCHER VALUE '1'. Choice 2 05 W-PLAYER-POSITION PIC X(01). Choice 3 05 W-PLAYER-POSITION PIC X(01) VALUE '1' '2' '3' '4' '5'. Choice 4 05 W-PITCHER PIC X(01) VALUE '1'. 05 W-CATCHER PIC X(01) VALUE '2'. 05 W-FIRST PIC X(01) VALUE '3'. 05 W-SECOND PIC X(01) VALUE '4'. 05 W-THIRD PIC X(01) VALUE '5'. Choice 5 05 W-PLAYER-POSITION PIC X(01). 88 W-PITCHER VALUE '1'. 88 W-CATCHER VALUE '2'. 88 W-FIRST VALUE '3'. 88 W-SECOND VALUE '4'. 88 W-THIRD VALUE '5'. COBOL II, Question 23 of 40

Which one of the following is one of the standard clauses used with the COPY statement? Choice 1 FROM Choice 2 UNTIL Choice 3 ALL Choice 4 REPLACING Choice 5 MEMBER COBOL II, Question 24 of 40

In which one of the following areas are the parameters defined that are passed from the calling program? Choice 1 WORKING-STORAGE SECTION Choice 2 LINKAGE SECTION Choice 3 INPUT-OUTPUT SECTION Choice 4 REPORT SECTION Choice 5 PROCEDURE DIVISION USING COBOL II, Question 25 of 40

6

Page 7: COBOL Brainbench(Set1 2 3 4)

Sample Code DATA DIVISION. WORKING-STORAGE SECTION. 01 DATA-AREA1. 05 DATA-AREA2 PIC S9(5). 01 DATA-AREA3 PIC S9(5) COMP-3 VALUE +12345. PROCEDURE DIVISION. MOVE DATA-AREA3 TO DATA-AREA1. ADD +1 TO DATA-AREA2. Which one of the following exceptions results from the execution of the ADD statement in the sample code above? Choice 1 data exception Choice 2 fixed-point overflow exception Choice 3 specification exception Choice 4 decimal divide exception Choice 5 The value of DATA-AREA2 becomes +12346. COBOL II, Question 26 of 40

Sample Code 0100 IDENTIFICATION DIVISION. 0200 PROGRAM-NAME. AM82P115. Which one of the following is INCORRECT in the sample code above? Choice 1 NAME should not be capitalized. Choice 2 Line 0200 should be Program-Identification. AM820115. Choice 3 Line 0200 should be Program-ID. AM820115. Choice 4 The first two statements should not end with a period. Choice 5 There should not be a hyphen between PROGRAM and NAME. COBOL II, Question 27 of 40

Which one of the following is produced by the compiler option XREF? Choice 1 A sorted cross-reference of data and procedure names, as well as an imbedded cross-reference and a cross-reference of programs Choice 2

A listing of line numbers that are in ascending sequence in the source program Choice 3 An unsorted cross-reference of data and procedure names Choice 4 A data description listing Choice 5 A compiler-generated listing of the numbers associated with each statement included in the program as a result of using the COPY directive COBOL II, Question 28 of 40

Sample Code IF S04-MBN = '1234' PERFORM HANDLE-SPECIAL-CUSTOMER END-IF. IF S04-MBN = '5678' PERFORM HANDLE-REGULAR-CUSTOMER END-IF. Which one of the following statements is equivalent to the sample code shown above? Choice 1 EVALUATE TRUE WHEN S04-MBN = '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN S04-MBN = '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. Choice 2 EVALUATE S04-MBN WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. Choice 3 EVALUATE TRUE ALSO TRUE WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. Choice 4 EVALUATE S04-MBN WHEN '1234' PERFORM HANDLE-SPECIAL-CUSTOMER WHEN '5678' PERFORM HANDLE-REGULAR-CUSTOMER END-EVALUATE. Choice 5 EVALUATE S04-MBN ALSO S04-MBN WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. COBOL II, Question 29 of 40

7

Page 8: COBOL Brainbench(Set1 2 3 4)

Which one of the following is INCORRECT? Choice 1 01 FIELD1 PIC 9(5) VALUE ZEROS. Choice 2 01 FIELD1 PIC 9(5) VALUE 123. Choice 3 01 FIELD1 PIC S9(5)V9 VALUE 12345.6. Choice 4 01 FIELD1 PIC S9(3)V99 VALUE +123.45. Choice 5 01 FIELD1 PIC 9(5) VALUE -123. COBOL II, Question 30 of 40

Sample Code 05 TAX-AMT PIC 9(02)V99 VALUE 30. 05 INTEREST-AMT PIC 9(02)V99 VALUE 10. 05 TOTAL-AMT PIC 9(03)V99 VALUE 100. Using the Working Storage fields above, what value is in TOTAL-AMT after the following statement?

SUBTRACT 10.35 TAX-AMT INTEREST-AMT FROM TOTAL-AMT. Choice 1 -29.8 Choice 2 49.65 Choice 3 89.8 Choice 4 92 Choice 5 149.65 COBOL II, Question 31 of 40

Which one of the following statements describes the function of the debugging option WHEN? Choice 1 It is an efficient tool to use during initial compiler debugging phases. Choice 2 It checks for specific conditions after each paragraph is executed during a debugging session. Choice 3 It allows you to check for a specific condition while debugging. Choice 4 It structures compiler output for debugging in a specific order under certain conditions. Choice 5 It provides the ability to select whether compilation is aborted while debugging. COBOL II, Question 32 of 40

Scenario 0010 MAIN-LINE. 0020 OPEN INPUT T-FILE. 0030 OPEN I-O M-FILE. 0040 PERFORM UNTIL EOF-T-FILE 0050 READ T-FILE NEXT 0060 AT END MOVE 'Y' TO SW-EOF-T-FILE 0070 NOT AT END 0080 MOVE T-FILE-KEY TO M-FILE-KEY 0090 READ M-FILE 0100 INVALID KEY 0110 MOVE T-INFO to M-INFO 0120 WRITE M-REC 0130 INVALID KEY 0140 PERFORM BAD-M-IO 0150 END-WRITE 0160 NOT INVALID KEY 0170 MOVE T-INFO TO M-INFO 0180 REWRITE M-REC 0190 INVALID KEY 0200 PERFORM BAD-M-IO 0210 END-REWRITE 0220 END-READ 0230 END-READ 0240 END-PERFORM. The code shown in the scenario above is an example of a sequential transaction file updating an indexed master file.

Which one of the following statements or clauses causes the perform loop to end? Choice 1 Line 0060 Choice 2 Line 0100 Choice 3 Line 0130 Choice 4 Line 0140 Choice 5 Line 0190 COBOL II, Question 33 of 40

Scenario A large text field contains all the first names of the students in a first grade class with each entry separated by a comma. Use the INSPECT statement to determine the number of names in the text field. If the text field contained only three names, there would be only two commas, for example, "BARRY, BRETT, HAL."

05 W-TEXT-FIELD PIC X(500). 05 W-NUM-OF-STUDENTS PIC 9(03). 05 A-COUNT1 PIC 9(03).

8

Page 9: COBOL Brainbench(Set1 2 3 4)

Referring to the Working Storage fields in the scenario above, which one of the following correctly handles these requirements? Choice 1 MOVE 0 TO A-COUNT1 INSPECT W-TEXT-FIELD TALLYING A-COUNT1 FOR ALL ','. Choice 2 MOVE 0 TO A-COUNT1 INSPECT W-TEXT-FIELD TALLYING A-COUNT1 FOR ALL ',' ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS. Choice 3 INSPECT W-TEXT-FIELD ADD 1 TO A-COUNT1 FOR ALL ',' ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS. Choice 4 MOVE 0 TO A-COUNT1 INSPECT W-TEXT-FIELD TALLYING A-COUNT1 FOR LEADING ',' ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS. Choice 5 MOVE 0 TO A-COUNT1 INSPECT W-TEXT-FIELD REPLACING A-COUNT1 FOR ALL ',' ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS. COBOL II, Question 34 of 40

Sample Code DATA DIVISION. WORKING-STORAGE SECTION. 01 AFIELD PIC S9(3) COMP-3 VALUE +021. 01 BFIELD PIC S9(3) COMP-3 VALUE +005. PROCEDURE DIVISION. MULTIPLY AFIELD BY BFIELD. DISPLAY BFIELD. Which one of the following values is displayed by the DISPLAY statement in the sample code above? Choice 1 +005 Choice 2 +021 Choice 3 +105 Choice 4 +232 Choice 5 +323 COBOL II, Question 35 of 40

Sample Code IF W-AMT1 EQUALS W-AMT2 MOVE 0 TO A-COUNT1

ELSE MOVE 100 TO A-COUNT1 END-IF Which one of the following errors occurs in the sample code above? Choice 1 EQUALS should be replaced with IS EQUAL TO. Choice 2 0 cannot be moved to a counter. Choice 3 ELSE should be replaced with ELSEIF. Choice 4 END-IF should be replaced with ENDIF. Choice 5 THEN should follow the IF statement. COBOL II, Question 36 of 40

Sample Code DATA DIVISION. WORKING-STORAGE SECTION. 01 FILLER. 05 DATA-ITEM PIC X(10) VALUE '0011237695'. 05 RECEIVING-FIELD PIC X(4). ... PROCEDURE DIVISION. ... MOVE DATA-ITEM (7:3) TO RECEIVING-FIELD. ... Assuming 'b' is space, which one of the following values does RECEIVING-FIELD contain following execution of the MOVE statement in the sample code above? Choice 1 695b Choice 2 b695 Choice 3 769b Choice 4 b769 Choice 5 7695 COBOL II, Question 37 of 40

Sample Code WORKING-STORAGE SECTION.

77 OT-HOURS PIC S9(3) COMP-3. 77 REG-HOURS PIC S9(3) COMP-3. 77 OT-COUNT PIC S9(3) COMP-3 VALUE +1.

PROCEDURE DIVISION. ....

IF REG-HOURS > +40 COMPUTE OT-HOURS = REG-HOURS - 40 ADD +1 TO OT-COUNT. ....

9

Page 10: COBOL Brainbench(Set1 2 3 4)

Given that OT-COUNT is not modified anywhere else in the sample code above, after executing the segment 1000 times, which one of the following is the value contained in the field OT-COUNT? Choice 1 000 Choice 2 001 Choice 3 999 Choice 4 1000 Choice 5 1001 COBOL II, Question 38 of 40

Sample Code 01 FROM-AREA. 05 FIELDA PIC X(10) VALUE 'ABCDEFGHIJ'. 05 PTR USAGE IS POINTER. 05 ARRAY OCCURS 3 TIMES PIC X(10) VALUE SPACES. 05 AREA-INDEX USAGE IS INDEX. 01 TO-AREA. 05 FIELDA PIC X(10). 05 PTR USAGE IS POINTER. 05 ARRAY OCCURS 3 TIMES PIC X(10). 05 AREA-INDEX USAGE IS INDEX. ... MOVE CORRESPONDING FROM-AREA TO TO-AREA. Which one of the following is moved as a result of the MOVE CORRESPONDING statement in the sample code above? Choice 1 AREA-INDEX and PTR are the only fields moved. Choice 2 None of the fields are moved. Choice 3 FIELDA and ARRAY are the only fields moved. Choice 4 FIELDA and AREA-INDEX are the only fields moved. Choice 5 All fields are moved. COBOL II, Question 39 of 40

Sample Code 0080 IF PROCESS-FILE-TRUE 0090 READ INPUT-FILE AT END 0100 IF INPUT-COUNTER = ZERO 0110 PERFORM EMPTY-FILE 0120 ELSE

0130 PERFORM NON-EMPTY-FILE 0140 END-IF 0150 END-READ 0160 ELSE 0170 PERFORM SKIP-PROCESSING 0180 END-IF. In the example shown in the sample code above, the END-IF on line 0140 terminates the statement on which one of the following lines? Choice 1 0080 Choice 2 0100 Choice 3 0160 Choice 4 0170 Choice 5 0180 COBOL II, Question 40 of 40

++++++++++++++++++++++++++++++++++++++Set 2+++++++++++++++++++++++++++++++++++++++

Formula A worker's total pay is calculated as the sum of the following: a) wage-rate multiplied by 40 hours b) (wage-rate multiplied by 1.5) multiplied by (hours-worked - 40) where item 'b' above is only calculated when hours-worked exceeds 40.

Assume a minimum of 40 hours are worked. You are given W-RATE and W-HRS-WORKED. Overtime

10

Page 11: COBOL Brainbench(Set1 2 3 4)

Hours can be calculated as hours worked in excess of 40 hours. Which one of the following statements correctly calculates Total Wages using the formula shown above? Choice 1 COMPUTE W-TOTAL-WAGES = W-RATE * 40 + 1.5 * W-RATE * (W-HRS-WORKED - 40) Choice 2 COMPUTE W-TOTAL-WAGES = W-RATE * 40 + 1.5 * W-RATE * W-HRS-WORKED Choice 3 COMPUTE W-TOTAL-WAGES = W-RATE * (40 + 1.5) * W-RATE * (W-HRS-WORKED - 40) Choice 4 COMPUTE W-TOTAL-WAGES = W-RATE * 40 + (1.5 * W-RATE * W-HRS-WORKED) Choice 5 COMPUTE W-TOTAL-WAGES = W-RATE X 40 + 1.5 X W-RATE X (W-HRS-WORKED - 40) COBOL II, Question 1 of 40

Scenario 0100 INITIAL-READ. 0110 READ MASTER-FILE 0120 AT END MOVE 'Y' TO MASTER-EOF-SW. 0130 PERFORM PROCESS-FILE 0140 UNTIL END-OF-TRANSACTIONS. 0150 GOBACK. 0160 PROCESS-FILE. 0170 READ TRANSACTION-FILE 0180 AT END MOVE 'Y' TO TRANSACTION-EOF-SW 0190 NOT AT END PERFORM PROCESS-A-RECORD. 0200 PROCESS-A-RECORD. 0210 IF TRANSACTION-KEY < PREVIOUS-KEY 0220 DISPLAY '??????' 0230 ELSE 0240 MOVE TRANSACTION-KEY TO PREVIOUS-KEY 0250 PERFORM UNTIL MASTER-KEY >= TRANSACTION-KEY 0260 READ MASTER-FILE 0270 AT END MOVE 'Y' TO MASTER-EOF-SW 0280 END-READ 0290 END-PERFORM 0300 IF MASTER-KEY = TRANSACTION-KEY 0310 MOVE TRANSACTION-RECORD TO MASTER-RECORD 0320 REWRITE MASTER-RECORD 0330 ELSE 0340 DISPLAY '??????'

0350 END-IF 0360 END-IF. The scenario above presents a simple master-transaction update program segment. Assume both files have been sorted into ascending sequence by the respective key fields. Referring to statement #0340, which one of the following errors has been detected?

Choice 1 The master file is out of sequence. Choice 2 There is no corresponding transaction record for the master being processed. Choice 3 A logic error has occurred. Choice 4 The transaction file is out of sequence. Choice 5 There is no corresponding master record for the transaction record being processed. COBOL II, Question 2 of 40

Which one of the following statements describes the functions provided by the compile option FLAG(x,y)? Choice 1 It organizes the procedure division into sections that are easily readable. Choice 2 This option informs the compiler to only list error messages with a specified warning level. Choice 3 It places messages directly into the compiler listing. Choice 4 It provides a way to fix compiler errors that are flagged. Choice 5 It flags errors that occur in the data division. COBOL II, Question 3 of 40

Scenario WORKING-STORAGE SECTION. 01 STATE-CODE PIC XX. 88 CALIFORNIA VALUE 'CA'. 88 COLORADO VALUE 'CO'. 88 CONNECTICUT VALUE 'CT'. 01 STATE-NAME PIC X(20).

PROCEDURE DIVISION.

EVALUATE TRUE WHEN CALIFORNIA

11

Page 12: COBOL Brainbench(Set1 2 3 4)

MOVE 'CALIFORNIA' TO STATE-NAME WHEN COLORADO MOVE 'COLORADO' TO STATE-NAME WHEN CONNECTICUT MOVE 'CONNECTICUT' TO STATE-NAME WHEN OTHER MOVE 'NO STATE NAME FOUND' TO STATE-NAME END-EVALUATE. Assume a value of TN is stored in the field STATE-CODE. Which one of the following logic errors, if any, is embedded in the scenario above? Choice 1 The scenario will abend. Choice 2 The scenario will not execute efficiently. Choice 3 The scenario assumes there are only three possible values for STATE-CODE. Choice 4 The scenario will execute with no problems. Choice 5 An IF statement should be used. COBOL II, Question 4 of 40

Sample Code DATA DIVISION. WORKING-STORAGE SECTION. 01 DATA-AREA1. 05 DATA-AREA2 PIC S9(5). 01 DATA-AREA3 PIC S9(5) COMP-3 VALUE +12345. PROCEDURE DIVISION. MOVE DATA-AREA3 TO DATA-AREA1. ADD +1 TO DATA-AREA2. Which one of the following exceptions results from the execution of the ADD statement in the sample code above? Choice 1 data exception Choice 2 fixed-point overflow exception Choice 3 specification exception Choice 4 decimal divide exception Choice 5 The value of DATA-AREA2 becomes +12346. COBOL II, Question 5 of 40

Sample Code 05 TAX-AMT PIC 9(02)V99 VALUE 30. 05 INTEREST-AMT PIC 9(02)V99 VALUE 10. 05 TOTAL-AMT PIC 9(03)V99 VALUE 100.

Using the Working Storage fields above, what value is in TOTAL-AMT after the following statement?

SUBTRACT 10.35 TAX-AMT INTEREST-AMT FROM TOTAL-AMT. Choice 1 -29.8 Choice 2 49.65 Choice 3 89.8 Choice 4 92 Choice 5 149.65 COBOL II, Question 6 of 40

Sample Record Layout REPORT SECTION. RD SalesReport CONTROLS ARE FINAL CityCode SalesPersonNum PAGE LIMIT IS 66 HEADING 1 FIRST DETAIL 6 LAST DETAIL 42 FOOTING 52. In the sample record layout above, which one of the following is the maximum number of lines of detail will be written per page of this report? Choice 1 37 Choice 2 42 Choice 3 52 Choice 4 60 Choice 5 66 COBOL II, Question 7 of 40

Sample Code 01 FIELD1 PIC 9(5) VALUE -123. 01 FIELD2 PIC S99 VALUE -12. 01 FIELD3 PIC S99 VALUE 99. Which one of the following is the reason the sample code above is INCORRECT? Choice 1 The VALUE clause and the PICTURE clause must match usage. Choice 2 The VALUE clause for FIELD3 is unsigned and the PICTURE clause is signed.

12

Page 13: COBOL Brainbench(Set1 2 3 4)

Choice 3 The VALUE clause for FIELD2 is signed and the PICTURE clause is signed. Choice 4 The VALUE clause for FIELD1 is signed and the PICTURE clause is unsigned. Choice 5 The VALUE clause for FIELD2 is not matched with the PICTURE clause. COBOL II, Question 8 of 40

Which one of the following sets of sections is used in the Data Division? Choice 1 File Working-Storage Linkage Report Choice 2 File Working-Storage Communication Linkage Choice 3 File Working-Storage External-Storage Reporting Choice 4 Configuration File Working-Storage Linkage Choice 5 I-O File Working-Storage Linkage COBOL II, Question 9 of 40

Which one of the following contains the four DIVISIONS used in COBOL? Choice 1 Identification Input-Output Data Procedural Choice 2 Identification Data Linkage Procedure Choice 3 Identification Environment Working-Storage

Procedure Choice 4 Identification Environment Data Procedure Choice 5 Identification Configuration Working Storage Procedure COBOL II, Question 10 of 40

Sample Code 05 W-CLASS-GRADE PIC X(01). 88 W-GRADE-EXCELLENT VALUE 'A'. 88 W-GRADE-GOOD VALUE 'B'. 88 W-GRADE-AVG VALUE 'C'. 88 W-GRADE-POOR VALUE 'D'. 88 W-GRADE-FAIL VALUE 'F'.

S0400-VERIFY-GRADE IF W-GRADE-EXCELLENT MOVE C-EXCELLENT-WORK TO W-COMMENT ELSE IF W-GRADE-GOOD MOVE C-GOOD-WORK TO W-COMMENT ELSE MOVE C-NO-COMMENT TO W-COMMENT END-IF. Referring to the above Working Storage field and sample code, which one of the following errors, if any, occurs in the sample code? Choice 1 TRUE or FALSE should be used on the IF statements. Choice 2 All '88 levels that were defined must be used in the IF statement. Choice 3 Grades 'C', 'D', and 'F' all fall into the "no comment" range. Choice 4 Relational operators cannot be used when a data name is used for the IF statement. Choice 5 The statement does not contain any errors. COBOL II, Question 11 of 40

Sample Code 01 FROM-AREA. 05 FIELDA PIC X(10) VALUE 'ABCDEFGHIJ'.

13

Page 14: COBOL Brainbench(Set1 2 3 4)

05 PTR USAGE IS POINTER. 05 ARRAY OCCURS 3 TIMES PIC X(10) VALUE SPACES. 05 AREA-INDEX USAGE IS INDEX. 01 TO-AREA. 05 FIELDA PIC X(10). 05 PTR USAGE IS POINTER. 05 ARRAY OCCURS 3 TIMES PIC X(10). 05 AREA-INDEX USAGE IS INDEX. ... MOVE CORRESPONDING FROM-AREA TO TO-AREA. Which one of the following is moved as a result of the MOVE CORRESPONDING statement in the sample code above? Choice 1 None of the fields are moved. Choice 2 All fields are moved. Choice 3 FIELDA and ARRAY are the only fields moved. Choice 4 AREA-INDEX and PTR are the only fields moved. Choice 5 FIELDA and AREA-INDEX are the only fields moved. COBOL II, Question 12 of 40

Scenario A large text field contains all the first names of the students in a first grade class with each entry separated by a comma. Use the INSPECT statement to determine the number of names in the text field. If the text field contained only three names, there would be only two commas, for example, "BARRY, BRETT, HAL."

05 W-TEXT-FIELD PIC X(500). 05 W-NUM-OF-STUDENTS PIC 9(03). 05 A-COUNT1 PIC 9(03). Referring to the Working Storage fields in the scenario above, which one of the following correctly handles these requirements? Choice 1 MOVE 0 TO A-COUNT1 INSPECT W-TEXT-FIELD TALLYING A-COUNT1 FOR ALL ',' ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS. Choice 2 MOVE 0 TO A-COUNT1 INSPECT W-TEXT-FIELD REPLACING A-COUNT1 FOR ALL ',' ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS.

Choice 3 MOVE 0 TO A-COUNT1 INSPECT W-TEXT-FIELD TALLYING A-COUNT1 FOR LEADING ',' ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS. Choice 4 MOVE 0 TO A-COUNT1 INSPECT W-TEXT-FIELD TALLYING A-COUNT1 FOR ALL ','. Choice 5 INSPECT W-TEXT-FIELD ADD 1 TO A-COUNT1 FOR ALL ',' ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS. COBOL II, Question 13 of 40

Which one of the following sets of sections are found in the Environment Division? Choice 1 Data Section and Procedure Section Choice 2 File Section and Data Definition Storage Section Choice 3 Configuration Section and Input-Output Section Choice 4 Communication Section and File Section Choice 5 Configuration Section and Data Section COBOL II, Question 14 of 40

Sample Code 01 NICKNAME PIC X(11). 01 DATA-FIELDS. 05 FLDA PIC X(11) VALUE 'SNOOKIEPOOH'. 05 FLDB PIC X(11) VALUE 'SNOOKIEbbbb'. 05 FLDC PIC X(11) VALUE 'WOOKIEbbbbb'. 05 FLDD PIC X(11) VALUE 'WICKIEWOCKb' ... MOVE FUNCTION MAX(FLDC FLDA FLDB FLDD) TO NICKNAME (1:11). Which one of the following values is contained in NICKNAME following execution of the MOVE statement in the sample code above?

Note: the character 'b' represents a blank. Choice 1 SNOOKIEPOOH Choice 2 WOOKbbbbbbb Choice 3 WOOKIEbbbbb Choice 4 WICKIEWOCKb

14

Page 15: COBOL Brainbench(Set1 2 3 4)

Choice 5 SNOOKIEbbbb COBOL II, Question 15 of 40

Sample Code 0080 IF PROCESS-FILE-TRUE 0090 READ INPUT-FILE AT END 0100 IF INPUT-COUNTER = ZERO 0110 PERFORM EMPTY-FILE 0120 ELSE 0130 PERFORM NON-EMPTY-FILE 0140 END-IF 0150 END-READ 0160 ELSE 0170 PERFORM SKIP-PROCESSING 0180 END-IF. In the example shown in the sample code above, the END-IF on line 0140 terminates the statement on which one of the following lines? Choice 1 0080 Choice 2 0100 Choice 3 0160 Choice 4 0170 Choice 5 0180 COBOL II, Question 16 of 40

Sample Code IF S04-MBN = '1234' PERFORM HANDLE-SPECIAL-CUSTOMER END-IF. IF S04-MBN = '5678' PERFORM HANDLE-REGULAR-CUSTOMER END-IF. Which one of the following statements is equivalent to the sample code shown above? Choice 1 EVALUATE S04-MBN ALSO S04-MBN WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. Choice 2 EVALUATE TRUE WHEN S04-MBN = '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN S04-MBN = '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. Choice 3

EVALUATE S04-MBN WHEN '1234' PERFORM HANDLE-SPECIAL-CUSTOMER WHEN '5678' PERFORM HANDLE-REGULAR-CUSTOMER END-EVALUATE. Choice 4 EVALUATE S04-MBN WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. Choice 5 EVALUATE TRUE ALSO TRUE WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. COBOL II, Question 17 of 40

Which one of the following is one of the standard clauses used with the COPY statement? Choice 1 MEMBER Choice 2 FROM Choice 3 ALL Choice 4 REPLACING Choice 5 UNTIL COBOL II, Question 18 of 40

Field Definitions W-TOTAL-AMT = total amount from all records W-NUM-RECS = total number of records W-AVG-AMT = average amount per record Using the field definitions above, which one of the following correctly computes the average amount per record? Choice 1 DIVIDE W-TOTAL-AMT BY W-NUM-RECS GIVING W-AVG-AMT. Choice 2 DIVIDE W-AVG-AMT INTO W-TOTAL-AMT. Choice 3 W-TOTAL-AMT DIVIDED BY W-NUM-RECS EQUALS W-AVG-AMT. Choice 4 W-TOTAL-AMT / W-NUM-RECS = W-AVG-AMT. Choice 5 DIVIDE W-TOTAL-AMT INTO W-NUM-RECS GIVING W-AVG-AMT. COBOL II, Question 19 of 40

15

Page 16: COBOL Brainbench(Set1 2 3 4)

Sample Code W-TOTAL-STUDENTS = Total number of students in Grade 5. W-TOTAL-PERMISSION = Total number of students in Grade 5 with permission slips for a field trip.

One teacher is required for every 10 students who will NOT be attending. Referring to the sample code above, which one of the following correctly calculates the number of teachers required to stay with the students who will NOT be attending the trip because they do NOT have permission slips? Choice 1 (W-TOTAL-STUDENTS - W-TOTAL-PERMISSION) / 10 GIVING W-TOTAL-TEACHERS Choice 2 CALCULATE W-TOTAL-TEACHERS = (W-TOTAL-STUDENTS - W-TOTAL-PERMISSION) / 10 Choice 3 W-TOTAL-TEACHERS = (W-TOTAL-STUDENTS - W-TOTAL-PERMISSION) / 10 Choice 4 W-TOTAL-TEACHERS = W-TOTAL-STUDENTS - W-TOTAL-PERMISSION / 10 Choice 5 COMPUTE W-TOTAL-TEACHERS = (W-TOTAL-STUDENTS - W-TOTAL-PERMISSION) / 10 COBOL II, Question 20 of 40

Sample Code DATA DIVISION. WORKING-STORAGE SECTION. 01 AFIELD PIC S9(3) COMP-3 VALUE +996. 01 BFIELD PIC S9(3) COMP-3 VALUE +117. PROCEDURE DIVISION. ADD AFIELD TO BFIELD. DISPLAY BFIELD. Which one of the following values is displayed as a result of the DISPLAY statement in the sample code above? Choice 1 +013 Choice 2 +113 Choice 3 +114 Choice 4 +1013 Choice 5 +1113 COBOL II, Question 21 of 40

Which one of the following statements describes the function of the debugging option WHEN? Choice 1 It structures compiler output for debugging in a specific order under certain conditions. Choice 2 It checks for specific conditions after each paragraph is executed during a debugging session. Choice 3 It provides the ability to select whether compilation is aborted while debugging. Choice 4 It allows you to check for a specific condition while debugging. Choice 5 It is an efficient tool to use during initial compiler debugging phases. COBOL II, Question 22 of 40

Sample Code DATA DIVISION. WORKING-STORAGE SECTION. 01 DATA-ARRAY. 05 DATA-FIELD OCCURS 10 TIMES PIC S9(3) COMP-3. PROCEDURE DIVISION. MOVE ZEROS TO DATA-ARRAY. ADD +1 TO DATA-FIELD (9). When executed, the sample code above results in which one of the following, exception codes? Choice 1 Protection exception Choice 2 Operation exception Choice 3 Data exception Choice 4 Boundary Violation Exception Choice 5 Decimal divide exception COBOL II, Question 23 of 40

Sample Code WORKING-STORAGE SECTION. 01 FIELDA PIC S9(3)V9(2) COMP-3 VALUE +1.12. 01 FIELDB PIC S9(3)V9(2) COMP-3 VALUE +1.07. 01 FINAL-RESULT PIC S9(3)V9(3) COMP-3. PROCEDURE DIVISION. COMPUTE FINAL-RESULT = FIELDA * FIELDB. Considering truncation may result, upon execution of the sample code above, the field

16

Page 17: COBOL Brainbench(Set1 2 3 4)

FINAL-RESULT contains which one of the following values? Choice 1 1V19 Choice 2 1V20 Choice 3 1V198 Choice 4 1V199 Choice 5 1V1984 COBOL II, Question 24 of 40

Scenario SELECT INPUT-MASTER-FILE ASSIGN TO IMASTER ORGANIZATION IS INDEXED ACCESS MODE IS RANDOM RECORD KEY IS IMF-BILLING-TELENO FILE STATUS IS IMASTER-FILE-STATUS. ...

PROCEDURE DIVISION.

0010-OPEN-FILES. OPEN INPUT INPUT-MASTER-FILE.

0020-START-FILES. MOVE '0000000001' TO IMF-BILLING-TELENO. START INPUT-MASTER-FILE. IF IMASTER-FILE-STATUS1 NOT = ZERO PERFORM 999-ABEND-ROUTINE GOBACK.

0030-READ-FILES. READ INPUT-MASTER-FILE. IF IMASTER-FILE-STATUS1 = ZERO PERFORM 100-UPDATE-RECORD ELSE IF IMASTER-FILE-STATUS = '23' PERFORM 200-NOT-FOUND ELSE PERFORM 999-ABEND-ROUTINE GOBACK. Which one of the following describes why the START statement in paragraph 0020-START-FILES in the scenario above is necessary? Choice 1 In order to prevent browsing by other programs Choice 2 In order to lock access to the file preventing I-O activity by other tasks Choice 3 In order to initiate a browse operation on a VSAM file Choice 4 In order to ensure that the file is available for further processing

Choice 5 In order to unlock access to the control interval containing the data COBOL II, Question 25 of 40

Sample Code WORKING-STORAGE SECTION.

77 OT-HOURS PIC S9(3) COMP-3. 77 REG-HOURS PIC S9(3) COMP-3. 77 OT-COUNT PIC S9(3) COMP-3 VALUE +1.

PROCEDURE DIVISION. ....

IF REG-HOURS > +40 COMPUTE OT-HOURS = REG-HOURS - 40 ADD +1 TO OT-COUNT. .... Given that OT-COUNT is not modified anywhere else in the sample code above, after executing the segment 1000 times, which one of the following is the value contained in the field OT-COUNT? Choice 1 000 Choice 2 001 Choice 3 999 Choice 4 1000 Choice 5 1001 COBOL II, Question 26 of 40

Which one of the following is the implicit scope terminator that ends the scope of any statement NOT explicitly terminated? Choice 1 END-EVALUATE Choice 2 END-IF Choice 3 END-READ Choice 4 END-PERFORM Choice 5 Period COBOL II, Question 27 of 40

------------------------Sample Code 0100 IF EMPLOYEE-CLASS = '01'

17

Page 18: COBOL Brainbench(Set1 2 3 4)

0200 IF EMPLOYEE-TYPE = 'SE' 0300 IF EMPLOYEE-AGE > 50 0400 PERFORM PERFORM BONUS-APPLICATION 0500 END-IF 0600 ELSE 0700 PERFORM SPECIAL-EMPLOYEE 0800 END-IF 0900 PERFORM SPECIAL-CLASS 1000 END-IF. 1100 PERFORM NEXT-TASK. In the sample code above, if

employee-class = '01' and employee-type = 'SE' and employee-age = 50;

which one of the following statements is executed? Choice 1 0400 Choice 2 0600 Choice 3 0700 Choice 4 0900 Choice 5 1200 COBOL II, Question 28 of 40

Sample Code 0100 IDENTIFICATION DIVISION. 0200 PROGRAM-NAME. AM82P115. Which one of the following is INCORRECT in the sample code above? Choice 1 The first two statements should not end with a period. Choice 2 There should not be a hyphen between PROGRAM and NAME. Choice 3 Line 0200 should be Program-Identification. AM820115. Choice 4 Line 0200 should be Program-ID. AM820115. Choice 5 NAME should not be capitalized. COBOL II, Question 29 of 40

Sample Code 0080 IF PROCESS-FILE-TRUE 0090 READ INPUT-FILE AT END 0100 IF INPUT-COUNTER = ZERO 0110 PERFORM EMPTY-FILE 0120 ELSE 0130 PERFORM NON-EMPTY-FILE 0140 END-IF

0150 END-READ 0160 ELSE 0170 PERFORM SKIP-PROCESSING 0180 END-IF. In the sample code above, the END-IF on line 0180 terminates the statement on which one of the following lines? Choice 1 0080 Choice 2 0100 Choice 3 0160 Choice 4 0170 Choice 5 0180 COBOL II, Question 30 of 40

Scenario 0010 MAIN-LINE. 0020 OPEN INPUT T-FILE. 0030 OPEN I-O M-FILE. 0040 PERFORM UNTIL EOF-T-FILE 0050 READ T-FILE NEXT 0060 AT END MOVE 'Y' TO SW-EOF-T-FILE 0070 NOT AT END 0080 MOVE T-FILE-KEY TO M-FILE-KEY 0090 READ M-FILE 0100 INVALID KEY 0110 MOVE T-INFO to M-INFO 0120 WRITE M-REC 0130 INVALID KEY 0140 PERFORM BAD-M-IO 0150 END-WRITE 0160 NOT INVALID KEY 0170 MOVE T-INFO TO M-INFO 0180 REWRITE M-REC 0190 INVALID KEY 0200 PERFORM BAD-M-IO 0210 END-REWRITE 0220 END-READ 0230 END-READ 0240 END-PERFORM. The code shown in the scenario above is an example of a sequential transaction file updating an indexed master file.

Which one of the following statements or clauses causes the perform loop to end? Choice 1 Line 0060 Choice 2 Line 0100 Choice 3 Line 0130 Choice 4 Line 0140

18

Page 19: COBOL Brainbench(Set1 2 3 4)

Choice 5 Line 0190 COBOL II, Question 31 of 40

Sample Code DATA DIVISION. WORKING-STORAGE SECTION. 01 AFIELD PIC S9(3) COMP-3 VALUE +021. 01 BFIELD PIC S9(3) COMP-3 VALUE +005. PROCEDURE DIVISION. MULTIPLY AFIELD BY BFIELD. DISPLAY BFIELD. Which one of the following values is displayed by the DISPLAY statement in the sample code above? Choice 1 +005 Choice 2 +021 Choice 3 +105 Choice 4 +232 Choice 5 +323 COBOL II, Question 32 of 40

Which one of the following statements causes a header line to be written at the top of a new page of a report? Choice 1 ADVANCE RPT-FILE PAGE WRITE RPT-HEADER Choice 2 WRITE RPT-RCD FROM RPT-HEADER Choice 3 WRITE RPT-RCD FROM RPT-HEADER AFTER ADVANCING PAGE Choice 4 WRITE RPT-RCD FROM RPT-HEADER BEFORE ADVANCING PAGE Choice 5 WRITE RPT-RCD AFTER ADVANCING FROM RPT-HEADER COBOL II, Question 33 of 40

Sample Code WORKING-STORAGE SECTION. 01 S04-RECORD. 05 S04-MBN PIC X(4). 88 S04-SPECIAL-CUSTOMER VALUE '1234'. 88 S04-REGULAR-CUSTOMER VALUE '5678'.

PROCEDURE DIVISION.

IF S04-SPECIAL-CUSTOMER PERFORM HANDLE-SPECIAL-CUSTOMER END-IF. IF S04-REGULAR-CUSTOMER PERFORM HANDLE-REGULAR-CUSTOMER END-IF. Which one of the following statements is equivalent to the sample code shown above? Choice 1 EVALUATE TRUE WHEN S04-REGULAR-CUSTOMER PERFORM HANDLE-REGULAR-CUSTOMER WHEN S04-SPECIAL-CUSTOMER PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. Choice 2 EVALUATE S04-MBN WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. Choice 3 EVALUATE S04-MBN ALSO S04-MBN WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. Choice 4 EVALUATE S04-MBN = TRUE WHEN '1234' PERFORM HANDLE-SPECIAL-CUSTOMER WHEN '5678' PERFORM HANDLE-REGULAR-CUSTOMER END-EVALUATE. Choice 5 EVALUATE TRUE ALSO TRUE WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. COBOL II, Question 34 of 40

Sample Code IF I-PLAYER-POSITION = '1' ADD 1 TO A-PITCHER-COUNT ELSE IF I-PLAYER-POSITION = '2' ADD 1 TO A-CATCHER-COUNT ELSE IF I-PLAYER-POSITION = '3' ADD 1 TO A-FIRST-COUNT

19

Page 20: COBOL Brainbench(Set1 2 3 4)

ELSE IF I-PLAYER-POSITION = '4' ADD 1 TO A-SECOND-COUNT ELSE IF I-PLAYER-POSITION = '5' ADD 1 TO A-THIRD-COUNT END-IF END-IF END-IF END-IF END-IF. Which one of the following Working Storage fields is used in an EVALUATE statement to replace the IF/ELSE logic in the sample code above? Choice 1 05 W-PLAYER-POSITION PIC X(01). 88 W-PITCHER VALUE '1'. 88 W-CATCHER VALUE '2'. 88 W-FIRST VALUE '3'. 88 W-SECOND VALUE '4'. 88 W-THIRD VALUE '5'. Choice 2 05 W-PLAYER-POSITION PIC X(01). 88 W-PITCHER VALUE '1'. Choice 3 05 W-PLAYER-POSITION PIC X(01). Choice 4 05 W-PITCHER PIC X(01) VALUE '1'. 05 W-CATCHER PIC X(01) VALUE '2'. 05 W-FIRST PIC X(01) VALUE '3'. 05 W-SECOND PIC X(01) VALUE '4'. 05 W-THIRD PIC X(01) VALUE '5'. Choice 5 05 W-PLAYER-POSITION PIC X(01) VALUE '1' '2' '3' '4' '5'. COBOL II, Question 35 of 40

Which one of the following is INCORRECT? Choice 1 01 FIELD1 PIC 9(5) VALUE ZEROS. Choice 2 01 FIELD1 PIC 9(5) VALUE 123. Choice 3 01 FIELD1 PIC S9(5)V9 VALUE 12345.6. Choice 4 01 FIELD1 PIC S9(3)V99 VALUE +123.45. Choice 5 01 FIELD1 PIC 9(5) VALUE -123. COBOL II, Question 36 of 40

Scenario WORKING-STORAGE SECTION. 01 STATE-CODE PIC XX. 88 CALIFORNIA VALUE 'CA'.

88 COLORADO VALUE 'CO'. 88 CONNECTICUT VALUE 'CT'. 01 STATE-NAME PIC X(20).

PROCEDURE DIVISION.

IF CALIFORNIA MOVE 'CALIFORNIA' TO STATE-NAME ELSE IF COLORADO MOVE 'COLORADO' TO STATE-NAME ELSE MOVE 'CONNECTICUT' TO STATE-NAME. Assume a value of TN is stored in the field STATE-CODE. Which one of the following logic errors is embedded in the scenario above? Choice 1 The scenario assumes there are only three possible values for STATE-CODE. Choice 2 The scenario will execute efficiently. Choice 3 The scenario will abend. Choice 4 TN is not defined as a valid value. Choice 5 An EVALUATE statement should be used. COBOL II, Question 37 of 40

Sample Code Layout of library member IRECORD: 01 INPUT-RECORD. 05 INPUT-LAST-NAME PIC X(20). 05 INPUT-FIRST-NAME PIC X(10). 05 INPUT-TELENO PIC X(10). Referring to the sample code above, which one of the following is the correct sequence of instructions that will cause IRECORD to be copied into the program? Choice 1 FD INPUT-FILE COPY IRECORD. Choice 2 FD INPUT-FILE. 01 COPY IRECORD. Choice 3 FD INPUT-FILE. COPY IRECORD. Choice 4 FD INPUT-FILE. COPY I-RECORD. Choice 5 FD INPUT-FILE. COPY MEMBER IRECORD. COBOL II, Question 38 of 40

20

Page 21: COBOL Brainbench(Set1 2 3 4)

Sample Code DATA DIVISION. WORKING-STORAGE SECTION. 01 FILLER. 05 DATA-ITEM PIC X(10) VALUE '0011237695'. 05 RECEIVING-FIELD PIC X(4). ... PROCEDURE DIVISION. ... MOVE DATA-ITEM (7:3) TO RECEIVING-FIELD. ... Assuming 'b' is space, which one of the following values does RECEIVING-FIELD contain following execution of the MOVE statement in the sample code above? Choice 1 695b Choice 2 b695 Choice 3 769b Choice 4 b769 Choice 5 7695 COBOL II, Question 39 of 40

INITIALIZE has NO effect on which one of the following types of fields? Choice 1 PIC ZZ,ZZ9.99 Choice 2 FILLER or index items Choice 3 PIC 9(..) Choice 4 PIC S9(..) Choice 5 PIC S9(..) COMP-3 COBOL II, Question 40 of 40

++++++++++++++++++++++++++++++++++++++++++++Set-3++++++++++++++++++++++++++++++++++++++++++

Sample Code

0100 IF EMPLOYEE-CLASS = '01' 0200 IF EMPLOYEE-TYPE = 'SE' 0300 NEXT SENTENCE 0400 ELSE 0500 PERFORM ORDINARY-EMPLOYEE 0600 END-IF 0700 IF EMPLOYEE-TYPE = 'ES' 0800 PERFORM EXTRAORDINARY-EMPLOYEE 0900 END-IF 1000 END-IF.

1100 PERFORM NEXT-TASK. Referring to the sample code above, if

employee-class ='01' and employee-type ='SE',

which one of the following statements is executed? Choice 1

0400 Choice 2

0600 Choice 3

0700 Choice 4

0800 Choice 5

1100

Which one of the following statements describes the function of the debugging option WHEN? Choice 1

It allows you to check for a specific condition while debugging. Choice 2

It structures compiler output for debugging in a specific order under certain conditions. Choice 3

It checks for specific conditions after each paragraph is executed during a debugging session. Choice 4

It provides the ability to select whether compilation is aborted while debugging. Choice 5

It is an efficient tool to use during initial compiler debugging phases.

Sample Code Layout of library member IRECORD:

01 INPUT-RECORD. 05 INPUT-LAST-NAME PIC X(20). 05 INPUT-FIRST-NAME PIC X(10). 05 INPUT-TELENO PIC X(10). Referring to the sample code above, which one of the following is the correct sequence of instructions that will cause IRECORD to be copied into the program? Choice 1

FD INPUT-FILE. 01 COPY IRECORD. Choice 2

FD INPUT-FILE COPY IRECORD. Choice 3

FD INPUT-FILE.

21

Page 22: COBOL Brainbench(Set1 2 3 4)

COPY MEMBER IRECORD. Choice 4

FD INPUT-FILE. COPY I-RECORD. Choice 5

FD INPUT-FILE. COPY IRECORD.

Sample Code W-TOTAL-STUDENTS = Total number of

students in Grade 5. W-TOTAL-PERMISSION = Total number of students in Grade 5 with permission slips for a field trip.

One teacher is required for every 10 students who will NOT be attending. Referring to the sample code above, which one of the following correctly calculates the number of teachers required to stay with the students who will NOT be attending the trip because they do NOT have permission slips? Choice 1

(W-TOTAL-STUDENTS - W-TOTAL-PERMISSION) / 10 GIVING W-TOTAL-TEACHERS Choice 2

W-TOTAL-TEACHERS = W-TOTAL-STUDENTS - W-TOTAL-PERMISSION / 10 Choice 3

CALCULATE W-TOTAL-TEACHERS = (W-TOTAL-STUDENTS - W-TOTAL-PERMISSION) / 10 Choice 4

W-TOTAL-TEACHERS = (W-TOTAL-STUDENTS - W-TOTAL-PERMISSION) / 10 Choice 5

COMPUTE W-TOTAL-TEACHERS = (W-TOTAL-STUDENTS - W-TOTAL-PERMISSION) / 10

Sample Code 0080 IF PROCESS-FILE-TRUE

0090 READ INPUT-FILE AT END 0100 IF INPUT-COUNTER = ZERO 0110 PERFORM EMPTY-FILE 0120 ELSE 0130 PERFORM NON-EMPTY-FILE 0140 END-IF 0150 END-READ 0160 ELSE 0170 PERFORM SKIP-PROCESSING 0180 END-IF. In the example shown in the sample code above, the END-IF on line 0140 terminates the statement on which one of the following lines? Choice 1

0080 Choice 2

0100 Choice 3

0160 Choice 4

0170 Choice 5

0180

Sample Code 0100 IF EMPLOYEE-CLASS = '01'

0200 IF EMPLOYEE-TYPE = 'SE' 0300 IF EMPLOYEE-AGE > 50 0400 PERFORM PERFORM BONUS-APPLICATION 0500 END-IF 0600 ELSE 0700 PERFORM SPECIAL-EMPLOYEE 0800 END-IF 0900 PERFORM SPECIAL-CLASS 1000 END-IF. 1100 PERFORM NEXT-TASK. In the sample code above, if

employee-class = '01' and employee-type = 'SE' and employee-age = 50;

which one of the following statements is executed? Choice 1

0400 Choice 2

0600 Choice 3

0700 Choice 4

0900 Choice 5

1200

Sample Record Layout REPORT SECTION.

RD SalesReport CONTROLS ARE FINAL CityCode SalesPersonNum PAGE LIMIT IS 66 HEADING 1 FIRST DETAIL 6 LAST DETAIL 42 FOOTING 52. In the sample record layout above, which one of the following is the maximum number of lines of detail will be written per page of this report? Choice 1

37 Choice 2

42 Choice 3

52 Choice 4

60

22

Page 23: COBOL Brainbench(Set1 2 3 4)

Choice 5 66

In which one of the following areas are the parameters defined that are passed from the calling program? Choice 1

WORKING-STORAGE SECTION Choice 2

REPORT SECTION Choice 3

INPUT-OUTPUT SECTION Choice 4

PROCEDURE DIVISION USING Choice 5

LINKAGE SECTION

DATA DIVISION. WORKING-STORAGE SECTION. 01 AFIELD PIC S9(3) COMP-3 VALUE +020. 01 BFIELD PIC S9(3) COMP-3 VALUE +5. PROCEDURE DIVISION. DIVIDE AFIELD BY BFIELD GIVING BFIELD. DISPLAY BFIELD. Which one of the following values is displayed by the DISPLAY statement in the sample code above? Choice 1

+0 Choice 2

+1 Choice 3

+4 Choice 4

+6 Choice 5

+8

Which one of the following sets of sections are found in the Environment Division? Choice 1

Communication Section and File Section Choice 2

Configuration Section and Data Section Choice 3

File Section and Data Definition Storage Section Choice 4

Configuration Section and Input-Output Section Choice 5

Data Section and Procedure Section

Scenario

SELECT INPUT-MASTER-FILE ASSIGN TO IMASTER ORGANIZATION IS INDEXED ACCESS MODE IS RANDOM RECORD KEY IS IMF-BILLING-TELENO FILE STATUS IS IMASTER-FILE-STATUS. ...

PROCEDURE DIVISION.

0010-OPEN-FILES. OPEN INPUT INPUT-MASTER-FILE.

0020-START-FILES. MOVE '0000000001' TO IMF-BILLING-TELENO. START INPUT-MASTER-FILE. IF IMASTER-FILE-STATUS1 NOT = ZERO PERFORM 999-ABEND-ROUTINE GOBACK.

0030-READ-FILES. READ INPUT-MASTER-FILE. IF IMASTER-FILE-STATUS1 = ZERO PERFORM 100-UPDATE-RECORD ELSE IF IMASTER-FILE-STATUS = '23' PERFORM 200-NOT-FOUND ELSE PERFORM 999-ABEND-ROUTINE GOBACK. Which one of the following describes why the START statement in paragraph 0020-START-FILES in the scenario above is necessary? Choice 1

In order to lock access to the file preventing I-O activity by other tasks Choice 2

In order to unlock access to the control interval containing the data Choice 3

In order to ensure that the file is available for further processing Choice 4

In order to prevent browsing by other programs Choice 5

In order to initiate a browse operation on a VSAM file

Which one of the following contains the four DIVISIONS used in COBOL? Choice 1

Identification Environment Working-Storage Procedure Choice 2

Identification Environment Data

23

Page 24: COBOL Brainbench(Set1 2 3 4)

Procedure Choice 3

Identification Input-Output Data Procedural Choice 4

Identification Configuration Working Storage Procedure Choice 5

Identification Data Linkage Procedure

Definitions W-TOTAL-AMT = total amount from all

records W-NUM-RECS = total number of records W-AVG-AMT = average amount per record Using the field definitions above, which one of the following correctly computes the average amount per record? Choice 1

W-TOTAL-AMT / W-NUM-RECS = W-AVG-AMT. Choice 2

DIVIDE W-TOTAL-AMT BY W-NUM-RECS GIVING W-AVG-AMT. Choice 3

W-TOTAL-AMT DIVIDED BY W-NUM-RECS EQUALS W-AVG-AMT. Choice 4

DIVIDE W-TOTAL-AMT INTO W-NUM-RECS GIVING W-AVG-AMT. Choice 5

DIVIDE W-AVG-AMT INTO W-TOTAL-AMT.

Which one of the following is the implicit scope terminator that ends the scope of any statement NOT explicitly terminated? Choice 1

END-EVALUATE Choice 2

Period Choice 3

END-IF Choice 4

END-READ Choice 5

END-PERFORM

Sample Code 01 FROM-AREA.

05 FIELDA PIC X(10) VALUE 'ABCDEFGHIJ'. 05 PTR USAGE IS POINTER.

05 ARRAY OCCURS 3 TIMES PIC X(10) VALUE SPACES. 05 AREA-INDEX USAGE IS INDEX. 01 TO-AREA. 05 FIELDA PIC X(10). 05 PTR USAGE IS POINTER. 05 ARRAY OCCURS 3 TIMES PIC X(10). 05 AREA-INDEX USAGE IS INDEX. ... MOVE CORRESPONDING FROM-AREA TO TO-AREA. Which one of the following is moved as a result of the MOVE CORRESPONDING statement in the sample code above? Choice 1

AREA-INDEX and PTR are the only fields moved. Choice 2

FIELDA and ARRAY are the only fields moved. Choice 3

FIELDA and AREA-INDEX are the only fields moved. Choice 4

None of the fields are moved. Choice 5

All fields are moved.

Which one of the following statements describes the functions provided by the compile option FLAG(x,y)? Choice 1

It organizes the procedure division into sections that are easily readable. Choice 2

This option informs the compiler to only list error messages with a specified warning level. Choice 3

It flags errors that occur in the data division. Choice 4

It places messages directly into the compiler listing. Choice 5

It provides a way to fix compiler errors that are flagged.

INITIALIZE has NO effect on which one of the following types of fields? Choice 1

PIC S9(..) Choice 2

FILLER or index items Choice 3

PIC S9(..) COMP-3

24

Page 25: COBOL Brainbench(Set1 2 3 4)

Choice 4 PIC 9(..)

Choice 5 PIC ZZ,ZZ9.99

Sample Code IF S04-MBN = '1234'

PERFORM HANDLE-SPECIAL-CUSTOMER END-IF. IF S04-MBN = '5678' PERFORM HANDLE-REGULAR-CUSTOMER END-IF. Which one of the following statements is equivalent to the sample code shown above? Choice 1

EVALUATE S04-MBN WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. Choice 2

EVALUATE S04-MBN WHEN '1234' PERFORM HANDLE-SPECIAL-CUSTOMER WHEN '5678' PERFORM HANDLE-REGULAR-CUSTOMER END-EVALUATE. Choice 3

EVALUATE TRUE WHEN S04-MBN = '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN S04-MBN = '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. Choice 4

EVALUATE TRUE ALSO TRUE WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. Choice 5

EVALUATE S04-MBN ALSO S04-MBN WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE.

Scenario WORKING-STORAGE SECTION.

01 STATE-CODE PIC XX. 88 CALIFORNIA VALUE 'CA'. 88 COLORADO VALUE 'CO'. 88 CONNECTICUT VALUE 'CT'. 01 STATE-NAME PIC X(20).

PROCEDURE DIVISION.

IF CALIFORNIA MOVE 'CALIFORNIA' TO STATE-NAME ELSE IF COLORADO MOVE 'COLORADO' TO STATE-NAME ELSE MOVE 'CONNECTICUT' TO STATE-NAME. Assume a value of TN is stored in the field STATE-CODE. Which one of the following logic errors is embedded in the scenario above? Choice 1

The scenario will abend. Choice 2

The scenario will execute efficiently. Choice 3

The scenario assumes there are only three possible values for STATE-CODE. Choice 4

An EVALUATE statement should be used. Choice 5

TN is not defined as a valid value.

01 NICKNAME PIC X(11). 01 DATA-FIELDS. 05 FLDA PIC X(11) VALUE 'SNOOKIEPOOH'. 05 FLDB PIC X(11) VALUE 'SNOOKIEbbbb'. 05 FLDC PIC X(11) VALUE 'WOOKIEbbbbb'. 05 FLDD PIC X(11) VALUE 'WICKIEWOCKb' ... MOVE FUNCTION MAX(FLDC FLDA FLDB FLDD) TO NICKNAME (1:11). Which one of the following values is contained in NICKNAME following execution of the MOVE statement in the sample code above?

Note: the character 'b' represents a blank. Choice 1

SNOOKIEbbbb Choice 2

WICKIEWOCKb Choice 3

SNOOKIEPOOH Choice 4

WOOKbbbbbbb Choice 5

WOOKIEbbbbb

Sample Code 0100 IDENTIFICATION DIVISION.

0200 PROGRAM-NAME. AM82P115. Which one of the following is INCORRECT in the sample code above? Choice 1

Line 0200 should be Program-ID. AM820115. Choice 2

25

Page 26: COBOL Brainbench(Set1 2 3 4)

There should not be a hyphen between PROGRAM and NAME. Choice 3

The first two statements should not end with a period. Choice 4

NAME should not be capitalized. Choice 5

Line 0200 should be Program-Identification. AM820115.

Sample Code 05 TAX-AMT PIC 9(02)V99 VALUE

30. 05 INTEREST-AMT PIC 9(02)V99 VALUE 10. 05 TOTAL-AMT PIC 9(03)V99 VALUE 100. Using the Working Storage fields above, what value is in TOTAL-AMT after the following statement?

SUBTRACT 10.35 TAX-AMT INTEREST-AMT FROM TOTAL-AMT. Choice 1

-29.8 Choice 2

49.65 Choice 3

89.8 Choice 4

92 Choice 5

149.65

--------------------------------------------------------------------------------------------------------------------------------------------------------- Which one of the following is INCORRECT? Choice 1

01 FIELD1 PIC 9(5) VALUE ZEROS. Choice 2

01 FIELD1 PIC 9(5) VALUE 123. Choice 3

01 FIELD1 PIC S9(5)V9 VALUE 12345.6. Choice 4

01 FIELD1 PIC S9(3)V99 VALUE +123.45. Choice 5

01 FIELD1 PIC 9(5) VALUE -123.

Scenario 0010 MAIN-LINE.

0020 OPEN INPUT T-FILE. 0030 OPEN I-O M-FILE. 0040 PERFORM UNTIL EOF-T-FILE 0050 READ T-FILE NEXT 0060 AT END MOVE 'Y' TO SW-EOF-T-FILE 0070 NOT AT END

0080 MOVE T-FILE-KEY TO M-FILE-KEY 0090 READ M-FILE 0100 INVALID KEY 0110 MOVE T-INFO to M-INFO 0120 WRITE M-REC 0130 INVALID KEY 0140 PERFORM BAD-M-IO 0150 END-WRITE 0160 NOT INVALID KEY 0170 MOVE T-INFO TO M-INFO 0180 REWRITE M-REC 0190 INVALID KEY 0200 PERFORM BAD-M-IO 0210 END-REWRITE 0220 END-READ 0230 END-READ 0240 END-PERFORM. The code shown in the scenario above is an example of a sequential transaction file updating an indexed master file.

Which one of the following statements or clauses causes the perform loop to end? Choice 1

Line 0060 Choice 2

Line 0100 Choice 3

Line 0130 Choice 4

Line 0140 Choice 5

Line 0190

Sample Code 05 W-CLASS-GRADE PIC X(01).

88 W-GRADE-EXCELLENT VALUE 'A'. 88 W-GRADE-GOOD VALUE 'B'. 88 W-GRADE-AVG VALUE 'C'. 88 W-GRADE-POOR VALUE 'D'. 88 W-GRADE-FAIL VALUE 'F'.

S0400-VERIFY-GRADE IF W-GRADE-EXCELLENT MOVE C-EXCELLENT-WORK TO W-COMMENT ELSE IF W-GRADE-GOOD MOVE C-GOOD-WORK TO W-COMMENT ELSE MOVE C-NO-COMMENT TO W-COMMENT END-IF. Referring to the above Working Storage field and sample code, which one of the following errors, if any, occurs in the sample code? Choice 1

All '88 levels that were defined must be used in the IF statement. Choice 2

26

Page 27: COBOL Brainbench(Set1 2 3 4)

Relational operators cannot be used when a data name is used for the IF statement. Choice 3

Grades 'C', 'D', and 'F' all fall into the "no comment" range. Choice 4

The statement does not contain any errors. Choice 5

TRUE or FALSE should be used on the IF statements.

Scenario A large text field contains all the

first names of the students in a first grade class with each entry separated by a comma. Use the INSPECT statement to determine the number of names in the text field. If the text field contained only three names, there would be only two commas, for example, "BARRY, BRETT, HAL."

05 W-TEXT-FIELD PIC X(500). 05 W-NUM-OF-STUDENTS PIC 9(03). 05 A-COUNT1 PIC 9(03). Referring to the Working Storage fields in the scenario above, which one of the following correctly handles these requirements? Choice 1

MOVE 0 TO A-COUNT1 INSPECT W-TEXT-FIELD TALLYING A-COUNT1 FOR ALL ','. Choice 2

MOVE 0 TO A-COUNT1 INSPECT W-TEXT-FIELD REPLACING A-COUNT1 FOR ALL ',' ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS. Choice 3

MOVE 0 TO A-COUNT1 INSPECT W-TEXT-FIELD TALLYING A-COUNT1 FOR LEADING ',' ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS. Choice 4

MOVE 0 TO A-COUNT1 INSPECT W-TEXT-FIELD TALLYING A-COUNT1 FOR ALL ',' ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS. Choice 5

INSPECT W-TEXT-FIELD ADD 1 TO A-COUNT1 FOR ALL ',' ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS.

Which one of the following is produced by the compiler option XREF? Choice 1

A data description listing Choice 2

A sorted cross-reference of data and procedure names, as well as an imbedded cross-reference and a cross-reference of programs Choice 3

A listing of line numbers that are in ascending sequence in the source program Choice 4

A compiler-generated listing of the numbers associated with each statement included in the program as a result of using the COPY directive Choice 5

An unsorted cross-reference of data and procedure names

Sample Code 0080 IF PROCESS-FILE-TRUE

0090 READ INPUT-FILE AT END 0100 IF INPUT-COUNTER = ZERO 0110 PERFORM EMPTY-FILE 0120 ELSE 0130 PERFORM NON-EMPTY-FILE 0140 END-IF 0150 END-READ 0160 ELSE 0170 PERFORM SKIP-PROCESSING 0180 END-IF. In the sample code above, the END-IF on line 0180 terminates the statement on which one of the following lines? Choice 1

0080 Choice 2

0100 Choice 3

0160 Choice 4

0170 Choice 5

0180

Scenario WORKING-STORAGE SECTION.

01 STATE-CODE PIC XX. 88 CALIFORNIA VALUE 'CA'. 88 COLORADO VALUE 'CO'. 88 CONNECTICUT VALUE 'CT'. 01 STATE-NAME PIC X(20).

PROCEDURE DIVISION.

EVALUATE TRUE WHEN CALIFORNIA

27

Page 28: COBOL Brainbench(Set1 2 3 4)

MOVE 'CALIFORNIA' TO STATE-NAME WHEN COLORADO MOVE 'COLORADO' TO STATE-NAME WHEN CONNECTICUT MOVE 'CONNECTICUT' TO STATE-NAME WHEN OTHER MOVE 'NO STATE NAME FOUND' TO STATE-NAME END-EVALUATE. Assume a value of TN is stored in the field STATE-CODE. Which one of the following logic errors, if any, is embedded in the scenario above? Choice 1

The scenario will execute with no problems. Choice 2

An IF statement should be used. Choice 3

The scenario will not execute efficiently. Choice 4

The scenario will abend. Choice 5

The scenario assumes there are only three possible values for STATE-CODE.

Sample Code 01 FIELD1 PIC 9(5) VALUE -123.

01 FIELD2 PIC S99 VALUE -12. 01 FIELD3 PIC S99 VALUE 99. Which one of the following is the reason the sample code above is INCORRECT? Choice 1

The VALUE clause for FIELD2 is signed and the PICTURE clause is signed. Choice 2

The VALUE clause for FIELD1 is signed and the PICTURE clause is unsigned. Choice 3

The VALUE clause for FIELD2 is not matched with the PICTURE clause. Choice 4

The VALUE clause and the PICTURE clause must match usage. Choice 5

The VALUE clause for FIELD3 is unsigned and the PICTURE clause is signed.

Sample Code DATA DIVISION.

WORKING-STORAGE SECTION. 01 AFIELD PIC S9(3) COMP-3 VALUE +996. 01 BFIELD PIC S9(3) COMP-3 VALUE +117. PROCEDURE DIVISION. ADD AFIELD TO BFIELD. DISPLAY BFIELD. Which one of the following values is displayed as a result of the DISPLAY statement in the sample code above?

Choice 1 +013

Choice 2 +113

Choice 3 +114

Choice 4 +1013

Choice 5 +1113

+++++++++++++++++++++++Set 4++++++++++++++++++++++++++++++++++++++++++++

Sample Code 0100 IF EMPLOYEE-CLASS (1:2) = '01' 0200 IF EMPLOYEE-TYPE (1:1) = 'S' 0300 NEXT SENTENCE 0400 ELSE 0500 PERFORM ORDINARY-EMPLOYEE 0600 END-IF 0700 IF EMPLOYEE-TYPE (1:1) = 'E' AND 0800 EMPLOYEE-STATUS (2:4) = 'WORK' 0900 PERFORM EXTRAORDINARY-EMPLOYEE 1000 END-IF 1100 END-IF. 1200 PERFORM NEXT-TASK. In the sample code above, if positions one (1) and two (2) of employee-class are equal to '01', position one (1) of employee-type is equal to 'E', and two (2) through five (5) of employee-status are NOT equal to 'WORK', which statement below is executed? Choice 1 0300 Choice 2 0400 Choice 3 0600 Choice 4 0900 Choice 5 1200 COBOL II, Question 1 of 40

Sample Code 05 TAX-AMT PIC 9(02)V99 VALUE 30. 05 INTEREST-AMT PIC 9(02)V99 VALUE 10. 05 TOTAL-AMT PIC 9(03)V99 VALUE 100. Using the Working Storage fields above, what value is in TOTAL-AMT after the following statement?

SUBTRACT 10.35 TAX-AMT INTEREST-AMT FROM TOTAL-AMT. Choice 1 -29.8

28

Page 29: COBOL Brainbench(Set1 2 3 4)

Choice 2 49.65 Choice 3 89.8 Choice 4 92 Choice 5 149.65 COBOL II, Question 2 of 40

Sample Code 0100 IDENTIFICATION DIVISION. 0200 PROGRAM-ID. AM822P115. Which one of the following is INCORRECT in the sample code above? Choice 1 Line 0200 is not a valid statement. Choice 2 There should not be a hyphen between PROGRAM and ID. Choice 3 Line 0200 should be Program Identification. AM8220115. Choice 4 The program name is too long. Choice 5 ID should not be capitalized. COBOL II, Question 3 of 40

Which one of the following is one of the standard clauses used with the COPY statement? Choice 1 UNTIL Choice 2 MEMBER Choice 3 ALL Choice 4 REPLACING Choice 5 FROM COBOL II, Question 4 of 40

Sample Code 0100 IF EMPLOYEE-CLASS = '01' 0200 IF EMPLOYEE-TYPE = 'SE' 0300 IF EMPLOYEE-AGE > 50 0400 PERFORM PERFORM BONUS-APPLICATION 0500 END-IF 0600 ELSE 0700 PERFORM SPECIAL-EMPLOYEE

0800 END-IF 0900 PERFORM SPECIAL-CLASS 1000 END-IF. 1100 PERFORM NEXT-TASK. In the sample code above, if

employee-class = '01' and employee-type = 'SE' and employee-age = 50;

which one of the following statements is executed? Choice 1 0400 Choice 2 0600 Choice 3 0700 Choice 4 0900 Choice 5 1200 COBOL II, Question 5 of 40

Scenario A large text field contains all the first names of the students in a first grade class with each entry separated by a comma. Use the INSPECT statement to determine the number of names in the text field. If the text field contained only three names, there would be only two commas, for example, "BARRY, BRETT, HAL."

05 W-TEXT-FIELD PIC X(500). 05 W-NUM-OF-STUDENTS PIC 9(03). 05 A-COUNT1 PIC 9(03). Referring to the Working Storage fields in the scenario above, which one of the following correctly handles these requirements? Choice 1 MOVE 0 TO A-COUNT1 INSPECT W-TEXT-FIELD TALLYING A-COUNT1 FOR ALL ',' ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS. Choice 2 MOVE 0 TO A-COUNT1 INSPECT W-TEXT-FIELD TALLYING A-COUNT1 FOR LEADING ',' ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS. Choice 3 INSPECT W-TEXT-FIELD ADD 1 TO A-COUNT1 FOR ALL ',' ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS. Choice 4 MOVE 0 TO A-COUNT1

29

Page 30: COBOL Brainbench(Set1 2 3 4)

INSPECT W-TEXT-FIELD TALLYING A-COUNT1 FOR ALL ','. Choice 5 MOVE 0 TO A-COUNT1 INSPECT W-TEXT-FIELD REPLACING A-COUNT1 FOR ALL ',' ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS. COBOL II, Question 6 of 40

Sample Code W-TOTAL-STUDENTS = Total number of students in Grade 5. W-TOTAL-PERMISSION = Total number of students in Grade 5 with permission slips for a field trip.

One teacher is required for every 10 students who will NOT be attending. Referring to the sample code above, which one of the following correctly calculates the number of teachers required to stay with the students who will NOT be attending the trip because they do NOT have permission slips? Choice 1 COMPUTE W-TOTAL-TEACHERS = (W-TOTAL-STUDENTS - W-TOTAL-PERMISSION) / 10 Choice 2 (W-TOTAL-STUDENTS - W-TOTAL-PERMISSION) / 10 GIVING W-TOTAL-TEACHERS Choice 3 CALCULATE W-TOTAL-TEACHERS = (W-TOTAL-STUDENTS - W-TOTAL-PERMISSION) / 10 Choice 4 W-TOTAL-TEACHERS = (W-TOTAL-STUDENTS - W-TOTAL-PERMISSION) / 10 Choice 5 W-TOTAL-TEACHERS = W-TOTAL-STUDENTS - W-TOTAL-PERMISSION / 10 COBOL II, Question 7 of 40

Sample Code DATA DIVISION. WORKING-STORAGE SECTION. 01 AFIELD PIC S9(3) COMP-3 VALUE +020. 01 BFIELD PIC S9(3) COMP-3 VALUE +5. PROCEDURE DIVISION. DIVIDE AFIELD BY BFIELD GIVING BFIELD. DISPLAY BFIELD. Which one of the following values is displayed by the DISPLAY statement in the sample code above? Choice 1 +0 Choice 2 +1

Choice 3 +4 Choice 4 +6 Choice 5 +8 COBOL II, Question 8 of 40

Which one of the following statements causes a header line to be written at the top of a new page of a report? Choice 1 ADVANCE RPT-FILE PAGE WRITE RPT-HEADER Choice 2 WRITE RPT-RCD FROM RPT-HEADER BEFORE ADVANCING PAGE Choice 3 WRITE RPT-RCD FROM RPT-HEADER Choice 4 WRITE RPT-RCD FROM RPT-HEADER AFTER ADVANCING PAGE Choice 5 WRITE RPT-RCD AFTER ADVANCING FROM RPT-HEADER COBOL II, Question 9 of 40

Sample Code DATA DIVISION. WORKING-STORAGE SECTION. 01 DATA-AREA1. 05 DATA-AREA2 PIC S9(5). 01 DATA-AREA3 PIC S9(5) COMP-3 VALUE +12345. PROCEDURE DIVISION. MOVE DATA-AREA3 TO DATA-AREA1. ADD +1 TO DATA-AREA2. Which one of the following exceptions results from the execution of the ADD statement in the sample code above? Choice 1 data exception Choice 2 fixed-point overflow exception Choice 3 specification exception Choice 4 decimal divide exception Choice 5 The value of DATA-AREA2 becomes +12346. COBOL II, Question 10 of 40

INITIALIZE has NO effect on which one of the following types of fields?

30

Page 31: COBOL Brainbench(Set1 2 3 4)

Choice 1 PIC ZZ,ZZ9.99 Choice 2 PIC S9(..) Choice 3 PIC 9(..) Choice 4 FILLER or index items Choice 5 PIC S9(..) COMP-3 COBOL II, Question 11 of 40

Sample Code 01 FROM-AREA. 05 FIELDA PIC X(10) VALUE 'ABCDEFGHIJ'. 05 PTR USAGE IS POINTER. 05 ARRAY OCCURS 3 TIMES PIC X(10) VALUE SPACES. 05 AREA-INDEX USAGE IS INDEX. 01 TO-AREA. 05 FIELDA PIC X(10). 05 PTR USAGE IS POINTER. 05 ARRAY OCCURS 3 TIMES PIC X(10). 05 AREA-INDEX USAGE IS INDEX. ... MOVE CORRESPONDING FROM-AREA TO TO-AREA. Which one of the following is moved as a result of the MOVE CORRESPONDING statement in the sample code above? Choice 1 FIELDA and ARRAY are the only fields moved. Choice 2 AREA-INDEX and PTR are the only fields moved. Choice 3 FIELDA and AREA-INDEX are the only fields moved. Choice 4 All fields are moved. Choice 5 None of the fields are moved. COBOL II, Question 12 of 40

Sample Code WORKING-STORAGE SECTION.

77 OT-HOURS PIC S9(3) COMP-3. 77 REG-HOURS PIC S9(3) COMP-3. 77 OT-COUNT PIC S9(3) COMP-3 VALUE +1.

PROCEDURE DIVISION. ....

IF REG-HOURS > +40 COMPUTE OT-HOURS = REG-HOURS - 40 ADD +1 TO OT-COUNT. .... Given that OT-COUNT is not modified anywhere else in the sample code above, after executing the segment 1000 times, which one of the following is the value contained in the field OT-COUNT? Choice 1 000 Choice 2 001 Choice 3 999 Choice 4 1000 Choice 5 1001 COBOL II, Question 13 of 40

Sample Code 05 W-CLASS-GRADE PIC X(01). 88 W-GRADE-EXCELLENT VALUE 'A'. 88 W-GRADE-GOOD VALUE 'B'. 88 W-GRADE-AVG VALUE 'C'. 88 W-GRADE-POOR VALUE 'D'. 88 W-GRADE-FAIL VALUE 'F'.

S0400-VERIFY-GRADE IF W-GRADE-EXCELLENT MOVE C-EXCELLENT-WORK TO W-COMMENT ELSE IF W-GRADE-GOOD MOVE C-GOOD-WORK TO W-COMMENT ELSE MOVE C-NO-COMMENT TO W-COMMENT END-IF. Referring to the above Working Storage field and sample code, which one of the following errors, if any, occurs in the sample code? Choice 1 Relational operators cannot be used when a data name is used for the IF statement. Choice 2 Grades 'C', 'D', and 'F' all fall into the "no comment" range. Choice 3 TRUE or FALSE should be used on the IF statements. Choice 4 The statement does not contain any errors. Choice 5 All '88 levels that were defined must be used in the IF statement. COBOL II, Question 14 of 40

31

Page 32: COBOL Brainbench(Set1 2 3 4)

Sample Code 01 NICKNAME PIC X(11). 01 DATA-FIELDS. 05 FLDA PIC X(11) VALUE 'SNOOKIEPOOH'. 05 FLDB PIC X(11) VALUE 'SNOOKIEbbbb'. 05 FLDC PIC X(11) VALUE 'WOOKIEbbbbb'. 05 FLDD PIC X(11) VALUE 'WICKIEWOCKb' ... MOVE FUNCTION MAX(FLDC FLDA FLDB FLDD) TO NICKNAME (1:11). Which one of the following values is contained in NICKNAME following execution of the MOVE statement in the sample code above?

Note: the character 'b' represents a blank. Choice 1 WICKIEWOCKb Choice 2 SNOOKIEPOOH Choice 3 SNOOKIEbbbb Choice 4 WOOKIEbbbbb Choice 5 WOOKbbbbbbb COBOL II, Question 15 of 40

Sample Code 01 FIELD1 PIC 9(5) VALUE -123. 01 FIELD2 PIC S99 VALUE -12. 01 FIELD3 PIC S99 VALUE 99. Which one of the following is the reason the sample code above is INCORRECT? Choice 1 The VALUE clause for FIELD1 is signed and the PICTURE clause is unsigned. Choice 2 The VALUE clause and the PICTURE clause must match usage. Choice 3 The VALUE clause for FIELD2 is not matched with the PICTURE clause. Choice 4 The VALUE clause for FIELD2 is signed and the PICTURE clause is signed. Choice 5 The VALUE clause for FIELD3 is unsigned and the PICTURE clause is signed. COBOL II, Question 16 of 40

Which one of the following sets of sections is used in the Data Division? Choice 1 I-O File Working-Storage Linkage

Choice 2 File Working-Storage Communication Linkage Choice 3 File Working-Storage Linkage Report Choice 4 File Working-Storage External-Storage Reporting Choice 5 Configuration File Working-Storage Linkage COBOL II, Question 17 of 40

Scenario WORKING-STORAGE SECTION. 01 STATE-CODE PIC XX. 88 CALIFORNIA VALUE 'CA'. 88 COLORADO VALUE 'CO'. 88 CONNECTICUT VALUE 'CT'. 01 STATE-NAME PIC X(20).

PROCEDURE DIVISION.

EVALUATE TRUE WHEN CALIFORNIA MOVE 'CALIFORNIA' TO STATE-NAME WHEN COLORADO MOVE 'COLORADO' TO STATE-NAME WHEN CONNECTICUT MOVE 'CONNECTICUT' TO STATE-NAME WHEN OTHER MOVE 'NO STATE NAME FOUND' TO STATE-NAME END-EVALUATE. Assume a value of TN is stored in the field STATE-CODE. Which one of the following logic errors, if any, is embedded in the scenario above? Choice 1 An IF statement should be used. Choice 2 The scenario will execute with no problems. Choice 3 The scenario will not execute efficiently. Choice 4 The scenario assumes there are only three possible values for STATE-CODE.

32

Page 33: COBOL Brainbench(Set1 2 3 4)

Choice 5 The scenario will abend. COBOL II, Question 18 of 40

Scenario 0010 MAIN-LINE. 0020 OPEN INPUT T-FILE. 0030 OPEN I-O M-FILE. 0040 PERFORM UNTIL EOF-T-FILE 0050 READ T-FILE NEXT 0060 AT END MOVE 'Y' TO SW-EOF-T-FILE 0070 NOT AT END 0080 MOVE T-FILE-KEY TO M-FILE-KEY 0090 READ M-FILE 0100 INVALID KEY 0110 MOVE T-INFO to M-INFO 0120 WRITE M-REC 0130 INVALID KEY 0140 PERFORM BAD-M-IO 0150 END-WRITE 0160 NOT INVALID KEY 0170 MOVE T-INFO TO M-INFO 0180 REWRITE M-REC 0190 INVALID KEY 0200 PERFORM BAD-M-IO 0210 END-REWRITE 0220 END-READ 0230 END-READ 0240 END-PERFORM. The code shown in the scenario above is an example of a sequential transaction file updating an indexed master file.

Which one of the following statements or clauses causes the perform loop to end? Choice 1 Line 0060 Choice 2 Line 0100 Choice 3 Line 0130 Choice 4 Line 0140 Choice 5 Line 0190 COBOL II, Question 19 of 40

Which one of the following statements describes the function of the debugging option WHEN? Choice 1 It structures compiler output for debugging in a specific order under certain conditions. Choice 2

It checks for specific conditions after each paragraph is executed during a debugging session. Choice 3 It provides the ability to select whether compilation is aborted while debugging. Choice 4 It is an efficient tool to use during initial compiler debugging phases. Choice 5 It allows you to check for a specific condition while debugging. COBOL II, Question 20 of 40

Which one of the following sets of sections are found in the Environment Division? Choice 1 Communication Section and File Section Choice 2 File Section and Data Definition Storage Section Choice 3 Configuration Section and Input-Output Section Choice 4 Configuration Section and Data Section Choice 5 Data Section and Procedure Section COBOL II, Question 21 of 40

Field Definitions W-TOTAL-AMT = total amount from all records W-NUM-RECS = total number of records W-AVG-AMT = average amount per record Using the field definitions above, which one of the following correctly computes the average amount per record? Choice 1 W-TOTAL-AMT / W-NUM-RECS = W-AVG-AMT. Choice 2 W-TOTAL-AMT DIVIDED BY W-NUM-RECS EQUALS W-AVG-AMT. Choice 3 DIVIDE W-TOTAL-AMT BY W-NUM-RECS GIVING W-AVG-AMT. Choice 4 DIVIDE W-AVG-AMT INTO W-TOTAL-AMT. Choice 5 DIVIDE W-TOTAL-AMT INTO W-NUM-RECS GIVING W-AVG-AMT. COBOL II, Question 22 of 40

Scenario SELECT INPUT-MASTER-FILE ASSIGN TO IMASTER

33

Page 34: COBOL Brainbench(Set1 2 3 4)

ORGANIZATION IS INDEXED ACCESS MODE IS RANDOM RECORD KEY IS IMF-BILLING-TELENO FILE STATUS IS IMASTER-FILE-STATUS. ...

PROCEDURE DIVISION.

0010-OPEN-FILES. OPEN INPUT INPUT-MASTER-FILE.

0020-START-FILES. MOVE '0000000001' TO IMF-BILLING-TELENO. START INPUT-MASTER-FILE. IF IMASTER-FILE-STATUS1 NOT = ZERO PERFORM 999-ABEND-ROUTINE GOBACK.

0030-READ-FILES. READ INPUT-MASTER-FILE. IF IMASTER-FILE-STATUS1 = ZERO PERFORM 100-UPDATE-RECORD ELSE IF IMASTER-FILE-STATUS = '23' PERFORM 200-NOT-FOUND ELSE PERFORM 999-ABEND-ROUTINE GOBACK. Which one of the following describes why the START statement in paragraph 0020-START-FILES in the scenario above is necessary? Choice 1 In order to ensure that the file is available for further processing Choice 2 In order to lock access to the file preventing I-O activity by other tasks Choice 3 In order to unlock access to the control interval containing the data Choice 4 In order to prevent browsing by other programs Choice 5 In order to initiate a browse operation on a VSAM file COBOL II, Question 23 of 40

Which one of the following statements describes the functions provided by the compile option FLAG(x,y)? Choice 1 This option informs the compiler to only list error messages with a specified warning level. Choice 2 It organizes the procedure division into sections that are easily readable. Choice 3

It flags errors that occur in the data division. Choice 4 It places messages directly into the compiler listing. Choice 5 It provides a way to fix compiler errors that are flagged. COBOL II, Question 24 of 40

Sample Code FILE SECTION. FD INPUT-CALL-DETAIL-FILE RECORD CONTAINS 13 CHARACTERS. 01 I-BILL-TO-RECORD. 05 I-BTN PIC X(13).

FD OUTPUT-CALL-DETAIL-FILE RECORD CONTAINS 13 CHARACTERS. 01 O-BILL-TO-RECORD. 05 O-BTN PIC X(13).

SD SORT-FILE RECORD CONTAINS 13 CHARACTERS. 01 SORT-BILL-TO-RECORD. 05 SORT-BTN. 10 SORT-TN. 15 SORT-NPA PIC 9(3). 15 SORT-NNX PIC 9(3). 15 SORT-LINE PIC 9(4). 10 SORT-CUSTCODE PIC X(3).

SORT SORT-FILE ON ASCENDING KEY ???????? WITH DUPLICATES IN ORDER USING INPUT-CALL-DETAIL-FILE GIVING OUTPUT-CALL-DETAIL-FILE. Referring to the sample code above, which one of the following fields do you specify in the ASCENDING KEY clause in order to sort the input file by the first ten (10) characters present on the input record? Choice 1 SORT-BTN Choice 2 SORT-TN Choice 3 SORT-NNX Choice 4 SORT-NPA Choice 5 SORT-BILL-TO-RECORD COBOL II, Question 25 of 40

Sample Code 0080 IF PROCESS-FILE-TRUE 0090 READ INPUT-FILE AT END

34

Page 35: COBOL Brainbench(Set1 2 3 4)

0100 IF INPUT-COUNTER = ZERO 0110 PERFORM EMPTY-FILE 0120 ELSE 0130 PERFORM NON-EMPTY-FILE 0140 END-IF 0150 END-READ 0160 ELSE 0170 PERFORM SKIP-PROCESSING 0180 END-IF. In the example shown in the sample code above, the END-IF on line 0140 terminates the statement on which one of the following lines? Choice 1 0080 Choice 2 0100 Choice 3 0160 Choice 4 0170 Choice 5 0180 COBOL II, Question 26 of 40

Sample Code IF I-PLAYER-POSITION = '1' ADD 1 TO A-PITCHER-COUNT ELSE IF I-PLAYER-POSITION = '2' ADD 1 TO A-CATCHER-COUNT ELSE IF I-PLAYER-POSITION = '3' ADD 1 TO A-FIRST-COUNT ELSE IF I-PLAYER-POSITION = '4' ADD 1 TO A-SECOND-COUNT ELSE IF I-PLAYER-POSITION = '5' ADD 1 TO A-THIRD-COUNT END-IF END-IF END-IF END-IF END-IF. Which one of the following Working Storage fields is used in an EVALUATE statement to replace the IF/ELSE logic in the sample code above? Choice 1 05 W-PLAYER-POSITION PIC X(01). 88 W-PITCHER VALUE '1'. Choice 2 05 W-PLAYER-POSITION PIC X(01). 88 W-PITCHER VALUE '1'.

88 W-CATCHER VALUE '2'. 88 W-FIRST VALUE '3'. 88 W-SECOND VALUE '4'. 88 W-THIRD VALUE '5'. Choice 3 05 W-PLAYER-POSITION PIC X(01). Choice 4 05 W-PITCHER PIC X(01) VALUE '1'. 05 W-CATCHER PIC X(01) VALUE '2'. 05 W-FIRST PIC X(01) VALUE '3'. 05 W-SECOND PIC X(01) VALUE '4'. 05 W-THIRD PIC X(01) VALUE '5'. Choice 5 05 W-PLAYER-POSITION PIC X(01) VALUE '1' '2' '3' '4' '5'. COBOL II, Question 27 of 40

Sample Code IF W-AMT1 EQUALS W-AMT2 MOVE 0 TO A-COUNT1 ELSE MOVE 100 TO A-COUNT1 END-IF Which one of the following errors occurs in the sample code above? Choice 1 EQUALS should be replaced with IS EQUAL TO. Choice 2 0 cannot be moved to a counter. Choice 3 ELSE should be replaced with ELSEIF. Choice 4 END-IF should be replaced with ENDIF. Choice 5 THEN should follow the IF statement. COBOL II, Question 28 of 40

Which one of the following is INCORRECT? Choice 1 01 FIELD1 PIC 9(5) VALUE ZEROS. Choice 2 01 FIELD1 PIC 9(5) VALUE 123. Choice 3 01 FIELD1 PIC S9(5)V9 VALUE 12345.6. Choice 4 01 FIELD1 PIC S9(3)V99 VALUE +123.45. Choice 5 01 FIELD1 PIC 9(5) VALUE -123. COBOL II, Question 29 of 40

Sample Code 0080 IF PROCESS-FILE-TRUE 0090 READ INPUT-FILE AT END

35

Page 36: COBOL Brainbench(Set1 2 3 4)

0100 IF INPUT-COUNTER = ZERO 0110 PERFORM EMPTY-FILE 0120 ELSE 0130 PERFORM NON-EMPTY-FILE 0140 END-IF 0150 END-READ 0160 ELSE 0170 PERFORM SKIP-PROCESSING 0180 END-IF. In the sample code above, the END-IF on line 0180 terminates the statement on which one of the following lines? Choice 1 0080 Choice 2 0100 Choice 3 0160 Choice 4 0170 Choice 5 0180 COBOL II, Question 30 of 40

Which one of the following contains the four DIVISIONS used in COBOL? Choice 1 Identification Input-Output Data Procedural Choice 2 Identification Environment Data Procedure Choice 3 Identification Data Linkage Procedure Choice 4 Identification Configuration Working Storage Procedure Choice 5 Identification Environment Working-Storage Procedure COBOL II, Question 31 of 40

Scenario WORKING-STORAGE SECTION. 01 STATE-CODE PIC XX. 88 CALIFORNIA VALUE 'CA'.

88 COLORADO VALUE 'CO'. 88 CONNECTICUT VALUE 'CT'. 01 STATE-NAME PIC X(20).

PROCEDURE DIVISION.

IF CALIFORNIA MOVE 'CALIFORNIA' TO STATE-NAME ELSE IF COLORADO MOVE 'COLORADO' TO STATE-NAME ELSE MOVE 'CONNECTICUT' TO STATE-NAME. Assume a value of TN is stored in the field STATE-CODE. Which one of the following logic errors is embedded in the scenario above? Choice 1 TN is not defined as a valid value. Choice 2 An EVALUATE statement should be used. Choice 3 The scenario assumes there are only three possible values for STATE-CODE. Choice 4 The scenario will execute efficiently. Choice 5 The scenario will abend. COBOL II, Question 32 of 40

Sample Code Layout of library member IRECORD: 01 INPUT-RECORD. 05 INPUT-LAST-NAME PIC X(20). 05 INPUT-FIRST-NAME PIC X(10). 05 INPUT-TELENO PIC X(10). Referring to the sample code above, which one of the following is the correct sequence of instructions that will cause IRECORD to be copied into the program? Choice 1 FD INPUT-FILE. COPY MEMBER IRECORD. Choice 2 FD INPUT-FILE. COPY IRECORD. Choice 3 FD INPUT-FILE COPY IRECORD. Choice 4 FD INPUT-FILE. COPY I-RECORD. Choice 5 FD INPUT-FILE. 01 COPY IRECORD. COBOL II, Question 33 of 40

36

Page 37: COBOL Brainbench(Set1 2 3 4)

Which one of the following is produced by the compiler option XREF? Choice 1 A sorted cross-reference of data and procedure names, as well as an imbedded cross-reference and a cross-reference of programs Choice 2 A listing of line numbers that are in ascending sequence in the source program Choice 3 A data description listing Choice 4 An unsorted cross-reference of data and procedure names Choice 5 A compiler-generated listing of the numbers associated with each statement included in the program as a result of using the COPY directive COBOL II, Question 34 of 40

Sample Code DATA DIVISION. WORKING-STORAGE SECTION. 01 FILLER. 05 DATA-ITEM PIC X(10) VALUE '0011237695'. 05 RECEIVING-FIELD PIC X(4). ... PROCEDURE DIVISION. ... MOVE DATA-ITEM (7:3) TO RECEIVING-FIELD. ... Assuming 'b' is space, which one of the following values does RECEIVING-FIELD contain following execution of the MOVE statement in the sample code above? Choice 1 695b Choice 2 b695 Choice 3 769b Choice 4 b769 Choice 5 7695 COBOL II, Question 35 of 40

In which one of the following areas are the parameters defined that are passed from the calling program? Choice 1 PROCEDURE DIVISION USING Choice 2 INPUT-OUTPUT SECTION

Choice 3 LINKAGE SECTION Choice 4 WORKING-STORAGE SECTION Choice 5 REPORT SECTION COBOL II, Question 36 of 40

Sample Code WORKING-STORAGE SECTION. 01 FIELDA PIC S9(3)V9(2) COMP-3 VALUE +1.12. 01 FIELDB PIC S9(3)V9(2) COMP-3 VALUE +1.07. 01 FINAL-RESULT PIC S9(3)V9(3) COMP-3. PROCEDURE DIVISION. COMPUTE FINAL-RESULT = FIELDA * FIELDB. Considering truncation may result, upon execution of the sample code above, the field FINAL-RESULT contains which one of the following values? Choice 1 1V19 Choice 2 1V20 Choice 3 1V198 Choice 4 1V199 Choice 5 1V1984 COBOL II, Question 37 of 40

Sample Code 0100 IDENTIFICATION DIVISION. 0200 PROGRAM-NAME. AM82P115. Which one of the following is INCORRECT in the sample code above? Choice 1 NAME should not be capitalized. Choice 2 Line 0200 should be Program-ID. AM820115. Choice 3 Line 0200 should be Program-Identification. AM820115. Choice 4 There should not be a hyphen between PROGRAM and NAME. Choice 5 The first two statements should not end with a period. COBOL II, Question 38 of 40

Scenario 0100 INITIAL-READ. 0110 READ MASTER-FILE

37

Page 38: COBOL Brainbench(Set1 2 3 4)

0120 AT END MOVE 'Y' TO MASTER-EOF-SW. 0130 PERFORM PROCESS-FILE 0140 UNTIL END-OF-TRANSACTIONS. 0150 GOBACK. 0160 PROCESS-FILE. 0170 READ TRANSACTION-FILE 0180 AT END MOVE 'Y' TO TRANSACTION-EOF-SW 0190 NOT AT END PERFORM PROCESS-A-RECORD. 0200 PROCESS-A-RECORD. 0210 IF TRANSACTION-KEY < PREVIOUS-KEY 0220 DISPLAY '??????' 0230 ELSE 0240 MOVE TRANSACTION-KEY TO PREVIOUS-KEY 0250 PERFORM UNTIL MASTER-KEY >= TRANSACTION-KEY 0260 READ MASTER-FILE 0270 AT END MOVE 'Y' TO MASTER-EOF-SW 0280 END-READ 0290 END-PERFORM 0300 IF MASTER-KEY = TRANSACTION-KEY 0310 MOVE TRANSACTION-RECORD TO MASTER-RECORD 0320 REWRITE MASTER-RECORD 0330 ELSE 0340 DISPLAY '??????' 0350 END-IF 0360 END-IF. The scenario above presents a simple master-transaction update program segment. Assume both files have been sorted into ascending sequence by the respective key fields. Referring to statement #0340, which one of the following errors has been detected?

Choice 1 The transaction file is out of sequence. Choice 2 A logic error has occurred. Choice 3 There is no corresponding transaction record for the master being processed. Choice 4 There is no corresponding master record for the transaction record being processed. Choice 5 The master file is out of sequence. COBOL II, Question 39 of 40

Sample Code WORKING-STORAGE SECTION. 01 S04-RECORD. 05 S04-MBN PIC X(4).

88 S04-SPECIAL-CUSTOMER VALUE '1234'. 88 S04-REGULAR-CUSTOMER VALUE '5678'.

PROCEDURE DIVISION.

IF S04-SPECIAL-CUSTOMER PERFORM HANDLE-SPECIAL-CUSTOMER END-IF. IF S04-REGULAR-CUSTOMER PERFORM HANDLE-REGULAR-CUSTOMER END-IF. Which one of the following statements is equivalent to the sample code shown above? Choice 1 EVALUATE TRUE WHEN S04-REGULAR-CUSTOMER PERFORM HANDLE-REGULAR-CUSTOMER WHEN S04-SPECIAL-CUSTOMER PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. Choice 2 EVALUATE TRUE ALSO TRUE WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. Choice 3 EVALUATE S04-MBN ALSO S04-MBN WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. Choice 4 EVALUATE S04-MBN WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. Choice 5 EVALUATE S04-MBN = TRUE WHEN '1234' PERFORM HANDLE-SPECIAL-CUSTOMER WHEN '5678' PERFORM HANDLE-REGULAR-CUSTOMER END-EVALUATE. COBOL II, Question 40 of 40

Ref: http://publib.boulder.ibm.com/infocenter/ratdevz/v7r5/index.jsp?topic=/com.ibm.ent.cbl.zos.doc/topics/PGandLR/ref/rlpsinit.htm

38