Cob 1with Ans

23
++++++++++++++++++++++ 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.

Transcript of Cob 1with Ans

Page 1: Cob 1with Ans

++++++++++++++++++++++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

Page 2: Cob 1with Ans

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. 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.

Page 3: Cob 1with Ans

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

Page 4: Cob 1with Ans

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 DIVIDE W-TOTAL-AMT INTO W-NUM-RECS GIVING W-AVG-AMT. COBOL II, Question 8 of 40

Page 5: Cob 1with Ans

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

Page 6: Cob 1with Ans

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.

... 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

Page 7: Cob 1with Ans

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).

Page 8: Cob 1with Ans

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 The scenario will execute with no problems. Choice 5 The scenario assumes there are only three possible values for STATE-CODE.

Page 9: Cob 1with Ans

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

Page 10: Cob 1with Ans

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' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE. COBOL II, Question 21 of 40

Page 11: Cob 1with Ans

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.

Page 12: Cob 1with Ans

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

Page 13: Cob 1with Ans

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

Page 14: Cob 1with Ans

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

Page 15: Cob 1with Ans

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

Page 16: Cob 1with Ans

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). Referring to the Working Storage fields in the scenario above, which one of the following correctly handles these requirements?

Page 17: Cob 1with Ans

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

Page 18: Cob 1with Ans

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.

Page 19: Cob 1with Ans

.... 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

Page 20: Cob 1with Ans

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