Professional Documents
Culture Documents
With Ans
With Ans
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
3)
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 STATECODE. 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
The scenario will abend.
Choice 3
The scenario assumes there are only three possible
values for STATE-CODE.
Choice 4
An EVALUATE statement should be used.
Choice 5
The scenario will execute efficiently.
4)
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
0100 IF EMPLOYEE-CLASS = '01'
0200
IF EMPLOYEE-TYPE = 'SE'
0300
PERFORM SPECIAL-EMPLOYEE
0400
ELSE
0500
NEXT SENTENCE
0600
END-IF
0700
PERFORM SPECIAL-CLASS
0800 ELSE
0900
PERFORM MANAGER-CLASS
1000
IF EMPLOYEE-TYPE = 'SE'
1100
PERFORM SPECIAL-EMPLOYEE
1200
END-IF
1300 END-IF.
1400 PERFORM GET-NEXT-EMPLOYEE
Referring to the sample code above, if:
employee-class='01'
employee-type = 'XE'
which perform statement is executed?
Choice 1
0300
Choice 2
0700
Choice 3
0900
Choice 4
1100
Choice 5
1400
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
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
0600
Choice
0700
Choice
0800
Choice
1100
2
3
4
5
DATA DIVISION.
FILE SECTION.
FD INPUT-FILE GLOBAL.
01 INPUT-RECORD.
05 INPUT-DATA
PIC X(80).
Which one of the following statements describes what
the GLOBAL clause feature as illustrated in the sample
code above provides?
Choice 1
TO O-A02-RECORD
1V88
Choice 4
1V89
Choice 5
1V884
05 S-A02-CHECK
88 S-A02-FOUND
88 S-A02-NOT-FOUND
PIC X(01).
VALUE 'Y'.
VALUE 'N'.
05 A-A02-RECORD-COUNT
PIC 9(03).
'A02'
TO S-A02-NOT-FOUND
'A02'
TO TRUE
'A02'
TO S-A02-FOUND
01 X
PIC 9.
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'
...
COMPUTE X = ORD-MIN(FLDA FLDB FLDC FLDD).
Which one of the following values is contained in X
following execution of the COMPUTE statement in the
sample code above?
Choice 1
0
Choice 2
1
Choice 3
2
Choice 4
3
Choice 5
4
DATA DIVISION.
WORKING-STORAGE SECTION.
01 FIELDA PIC S9(7) COMP-3 VALUE +1234567.
01 FIELDB PIC Z(3).99.
PROCEDURE DIVISION.
MOVE FIELDA TO FIELDB.
01) 0000-MAINLINE.
02)
READ INPUT-RECORD
03)
NOT AT END
04)
PERFORM 0100-CHECK-PAGE-BREAKS
05)
AT END ...
06) 0100-CHECK-PAGE-BREAKS.
07)
IF INPUT-DIVISION NOT = CURRENT-DIVISION
08)
PERFORM 0110-DIVISION-BREAK
09)
ELSE
10)
IF INPUT-DISTRICT NOT = CURRENT-DISTRICT
11)
PERFORM 0120-DISTRICT-BREAK
12)
ELSE
13)
IF INPUT-SECTION NOT = CURRENT-SECTION
14)
PERFORM 0130-SECTION-BREAK.
15) 0110-DIVISION-BREAK.
..
16) 0120-DISTRICT-BREAK.
17)
PERFORM 0150-NEW-PAGE-TOTALS.
18)
MOVE INPUT-DIVISION TO CURRENT-DIVISION.
19)
MOVE INPUT-DISTRICT TO CURRENT-DISTRICT.
20) 0130-SECTION-BREAK.
..
There is a logic error in the sample code above.
Divisions contain Districts: Districts contain
Sections. Page breaks should occur whenever division,
district, or section changes. Which line of code must
be changed in order to accomplish this?
Choice 1
Line 18: MOVE INPUT-SECTION TO CURRENT-SECTION
Choice 2
Line 18: MOVE INPUT-DISTRICT TO CURRENT-DISTRICT
Choice 3
Line 18: MOVE INPUT-DIVISION TO INPUT-DISTRICT
Choice 4
Line 19: MOVE INPUT-DIVISION TO CURRENT-DIVISION
Choice 5
Line 19: MOVE INPUT-SECTION TO CURRENT-SECTION
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.
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
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)
VALUE '1' '2' '3' '4' '5'.
Choice 2
05 W-PLAYER-POSITION PIC X(01).
88 W-PITCHER
VALUE '1'.
Choice 3
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 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).
MOVE 0
TO A-COUNT1
INSPECT W-TEXT-FIELD
TALLYING A-COUNT1 FOR ALL ','.
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
INSPECT W-TEXT-FIELD
ADD 1 TO A-COUNT1 FOR ALL ','
ADD 1
TO A-COUNT1 GIVING W-NUM-OF-STUDENTS
05 W-CLASS-GRADE
88 W-GRADE-EXCELLENT
88 W-GRADE-GOOD
88 W-GRADE-AVG
88 W-GRADE-POOR
88 W-GRADE-FAIL
PIC X(01).
VALUE 'A'.
VALUE 'B'.
VALUE 'C'.
VALUE 'D'.
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
The statement does not contain any errors.
Choice 4
Grades 'C', 'D', and 'F' all fall into the "no
comment" range.
Choice 5
Relational operators cannot be used when a data name
is used for the IF statement.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 INPUT-POINTER
USAGE IS INDEX GLOBAL.
01 INPUT-WORK-AREA
GLOBAL.
05 DATA-INDEX1
USAGE IS INDEX.
05 DATA-INDEX2
USAGE IS INDEX.
Referring to the sample code above, which one of the
following statements describes what the GLOBAL clause
feature provides?
Choice 1
It provides a means to define a field that may be used
in the subordinate programs nested within a
superordinate program.
Choice 2
It allows multiple programs to use the same field,
defined at the 01 level, without passing it between
programs via a CALL statement.
Choice 3
Fields defined as elementary items may be passed
between programs without using a CALL statement.
Choice 4
It allows implicitly defined indexes to be used by
multiple programs.
Choice 5
Any field defined in WORKING-STORAGE with the GLOBAL
clause may be passed between programs without using a
CALL statement.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 COST-CENTER-TABLE.
05 COST-CENTER OCCURS 1000 TIMES
PIC 9(8) VALUE 97516438.
01 COST-CENTER-INDEX USAGE IS INDEX.
01 COST-CENTER-RECEIVING PIC 9(4).
...
PROCEDURE DIVISION.
...
SET COST-CENTER-INDEX TO 930.
MOVE COST-CENTER (COST-CENTER-INDEX) (5: ) TO
COST-CENTER-RECEIVING.
The sample code above moves which one of the
following values to COST-CENTER-RECEIVING?
Choice 1
6348
Choice 2
6438
Choice 3
6834
Choice 4
9571
Choice 5
9751
Main routine....
CALL subroutine USING BY CONTENT '0123'.
Subroutine....
LINKAGE SECTION.
01 PASSED-FIELD PIC X(5).
PROCEDURE DIVISION USING PASSED-FIELD.
IF PASSED-FIELD = '0123 '
.....
FD O-REPORT-FILE.
01 O-REPORT-REC.
05 O-REPORT-HDR
05
05 O-REPORT-DATE.
10 O-REPORT-MM
10
10 O-REPORT-YY
05 O-REPORT-TIME
PIC X(40).
PIC X(02) VALUE SPACES.
PIC
PIC
PIC
PIC
X(02).
X(01) VALUE '/'.
X(02).
X(05).
01 WORK-AREAS.
05 W-DATE PIC X(08) VALUE '08/17/06'.
05 W-TIME PIC X(08) VALUE '03:10:44'.
Program Sample:
1) MOVE 'WORK HISTORY REPORT FOR: ' TO O-REPORT-HDR
2) MOVE W-DATE (1:2) TO O-REPORT-MM
3) MOVE W-DATE (7:2) TO O-REPORT-YY
4) MOVE W-TIME (1:8) TO O-REPORT-TIME
When a page break occurs, a new heading is printed
which includes the date and time as specified below.
Which lines of code above prevent this from being
produced correctly?
Date 08/06 or MM/YY
Time 03:10 or HH:MM
Choice 1
Line 1
Choice 2
Line 2
Choice 3
Lines 2 and 3
Choice 4
Line 3
Choice 5
Line 4
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
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
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.
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
EVALUATE A * B
WHEN 175
EVALUATE C + D
WHEN 234
CONTINUE
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
432-ROUTINE
Choice 5
None of the paragraphs specified will be performed
****************************???????????????????
Choice 1
FIELDB = $,$12,345.00
FIELDC = b,+12,345.00
FIELDD = $b,b12,345.00
Choice 2
FIELDB = $b12,345.00
FIELDC = +b12,345.00
FIELDD = $b12,345.00
Choice 3
FIELDB = b$b12,345.00
FIELDC = b+b12,345.00
FIELDD = $bb12,345.00
Choice 4
FIELDB = bb$12,345.00
FIELDC = bb+12,345.00
FIELDD = b$b12,345.00
Choice 5
FIELDB = $$12,345.00
FIELDC = bb+12,345.00
FIELDD = $bb12,345.00
******
0100 INITIAL-READ.
0110
READ MASTER-FILE
0120
AT END MOVE 'Y' TO MASTER-EOF-SW.
0130
READ TRANSACTION-FILE
0140
AT END MOVE 'Y' TO TRANSACTION-EOF-SW.
0150
PERFORM PROCESS-FILE
0160
UNTIL END-OF-MASTER OR
0170
END-OF-TRANSACTIONS.
0180
GOBACK.
0190 PROCESS-FILE.
0200
PERFORM UNTIL MASTER-KEY >= TRANSACTION-KEY
0210
WRITE MASTER-RECORD
0220
READ MASTER-RECORD AT END MOVE 'Y' TO
MASTER-EOF-SW
0230
END-PERFORM.
0240
IF NOT MASTER-EOF
0250
EVALUATE TRUE
0260
WHEN TRANSACTION-IS-DELETE
0270
PERFORM DELETE-MASTER
0280
WHEN TRANSACTION-IS-ADD
0290
PERFORM ADD-MASTER
0300
WHEN TRANSACTION-IS-UPDATE
0310
PERFORM UPDATE-MASTER
0320
END-EVALUATE.
0330 DELETE-MASTER.
0340
IF MASTER-KEY <> TRANSACTION-KEY
0350
DISPLAY '??????'
0360
WRITE MASTER-RECORD.
0370
READ MASTER-FILE AT END MOVE 'Y' TO MASTER-EOFSW.
0380
PERFORM GET-NEXT-TRANSACTION.
0390 ADD-MASTER.
...
0460 UPDATE-MASTER.
...
0540 GET-NEXT-TRANSACTION.
...
This is a tape-based master-transaction program
segment. Assume the files are sorted into ascending
sequence by key fields. Transactions may add, delete,
or update master file records. Referring to statement
#0350, what error, if any, has been detected?
Choice 1
PIC X(20)
VALUE "ABCDEABCDEABCDEABCDE".
Using the above definition, what value is stored in
FIELDA after the execution of the following?
PERFORM 4 TIMES
INSPECT FIELDA REPLACING "B"
BY X
BEFORE INITIAL "D"
END-PERFORM
Choice 1
ABCDEABCDEABCDEABCDE
Choice 2
AXCDEABCDEABCDEABCDE
Choice 3
AXCDEAXCDEABCDEABCDE
Choice 4
AXCDEAXCDEAXCDEABCDE
Choice 5
AXCDEAXCDEAXCDEAXCDE
6.
WORKING-STORAGE SECTION.
01 WORK-TABLE.
05 WK-ALPHA
PIC A(2) VALUE 'AB'.
05 FILLER
PIC X
VALUE '*'.
05 WK-ALPHANUM PIC X(4) VALUE 'CDEF'.
05
PIC X
VALUE '*'.
05 WK-NUM
PIC 999.
05
PIC X
VALUE '*'.
PROCEDURE DIVISION.
....
INITIALIZE WORK-TABLE.
After execution of the statement in the sample code
above, which one of the following values does WORKTABLE contain?
NOTE: b = BLANK or UNPRINTABLE HEXADECIMAL character
Choice 1
bb*bbbb*bb0*
Choice 2
ABbCDEFb000b
Choice 3
AB*CDEF*bb0*
Choice 4
bbbbbbbb000b
Choice 5
bb*bbbb*000*
7.
Copy Member PLAYER.
01 I-PLAYER-REC.
05 I-PLAYER-LAST-NAME
PIC X(20).
05 I-PLAYER-FIRST-NAME
PIC X(10).
05 I-PLAYER-SALARY
PIC 9(09)V99.
For a new program, the player record layout needs to
be used for an output file. Which one of the following
COPY statements will imbed the above copy member and
change the prefix of I- with O-?
Choice 1
COPY PLAYER USING "O-" INSTEAD OF "I-"
Choice 2
COPY PLAYER replacing ==I-== BY ==O-==.
10
Choice 3
COPY PLAYER
CHANGE ALL "I-" "O-".
Choice 4
COPY PLAYER remove "I-" add "O-".
Choice 5
COPY O-PLAYER.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 FLOATING-INSERTION-EDITS.
05 FIELDA PIC S9(5) COMP-3 VALUE +12345.
05 FIELDB PIC $,$$$,$$$.99.
05 FIELDC PIC +,+++,+++.++.
05 FIELDD PIC $ZZZ,ZZZ.99.
PROCEDURE DIVISION.
MOVE FIELDA TO FIELDB
FIELDC
FIELDD.
Which one of the following represents the final
values of FIELDB, FIELDC, and FIELDD after execution of
the sample code above?
NOTE: 'b' represents blank
Choice 1
FIELDB = $$12,345.00
FIELDC = bb+12,345.00
FIELDD = $bb12,345.00
Choice 2
FIELDB = b$b12,345.00
FIELDC = b+b12,345.00
FIELDD = $bb12,345.00
Choice 3
FIELDB = bb$12,345.00
FIELDC = bb+12,345.00
FIELDD = b$b12,345.00
Choice 4
FIELDB = $b12,345.00
FIELDC = +b12,345.00
FIELDD = $b12,345.00
Choice 5
FIELDB = $,$12,345.00
FIELDC = b,+12,345.00
FIELDD = $b,b12,345.00
0100 INITIAL-READ.
0110
READ MASTER-FILE
0120
AT END MOVE 'Y' TO MASTER-EOF-SW.
0130
READ TRANSACTION-FILE
0140
AT END MOVE 'Y' TO TRANSACTION-EOF-SW.
0150
PERFORM PROCESS-FILE
0160
UNTIL END-OF-MASTER OR
0170
END-OF-TRANSACTIONS.
0180
GOBACK.
0190 PROCESS-FILE.
0200
PERFORM UNTIL MASTER-KEY >= TRANSACTION-KEY
0210
WRITE MASTER-RECORD
0220
READ MASTER-RECORD AT END MOVE 'Y' TO
MASTER-EOF-SW
0230
END-PERFORM.
0240
IF NOT MASTER-EOF
0250
EVALUATE TRUE
0260
WHEN TRANSACTION-IS-DELETE
0270
PERFORM DELETE-MASTER
0280
WHEN TRANSACTION-IS-ADD
0290
PERFORM ADD-MASTER
0300
WHEN TRANSACTION-IS-UPDATE
0310
PERFORM UPDATE-MASTER
0320
END-EVALUATE.
0330 DELETE-MASTER.
...
0390 ADD-MASTER.
0400
IF MASTER-KEY = TRANSACTION-KEY
0410
DISPLAY '??????'
0420
WRITE MASTER-RECORD
0430
ELSE
0440
WRITE MASTER-RECORD FROM TRANSACTION-RECORD
0450
PERFORM GET-NEXT-TRANSACTION.
0460 UPDATE-MASTER.
...
0540 GET-NEXT-TRANSACTION.
...
This is a tape-based master-transaction program
segment. Assume the files are sorted into ascending
sequence by key fields. Transactions may add, delete,
or update master file records. Referring to statement
#0410, what error, if any, has been detected?
Choice 1
The master file is out of sequence.
Choice 2
An add transaction has been encountered for an
existing master.
Choice 3
The master record to be deleted does not exist.
Choice 4
The transaction file is out of sequence.
Choice 5
No error has occurred.
10.
You have been requested to create a sales report with
totals and subtotals for salesmen, districts in the
footers of the section breaks, and and national sales
totals at the end of the report.
Referring to the above, using COBOL REPORT WRITER,
where do you calculate the sum totals for the report
footer containing the National Totals?
Choice 1
In a standard paragraph contained in the PROCEDURE
DIVISION.
Choice 2
By using the SUM clause on the fields in the TYPE IS
CONTROL FOOTING FINAL line in the REPORT SECTION.
Choice 3
In the FIGURATIVE CONSTANTS section
Choice 4
Numeric fields defined in a FOOTER automatically sum
the numeric fields from the control break one level up.
Choice 5
It is calculated by coding an add of the fields in the
DECLARATIVES SECTION.
PIC X(01).
VALUE 'N'.
VALUE 'Y'.
MAINLINE.
SET S-END-OF-FILE
TO TRUE
PERFORM A0100-PRINT-DETAIL-AND-FOOTERS
UNTIL S-END-OF-FILE
END-PERFORM.
11
EVALUATE TRUE
WHEN A >= B ALSO C NOT = B ALSO E NOT > F
PERFORM FOUND-THIS
END-EVALUATE.
Which one of the following is the code segment in the
scenario above equivalent to?
Choice 1
IF A >= B
IF C <> D
IF E <= F
PERFORM FOUND-THIS.
Choice 2
IF A >= B
IF C <> B
IF E NOT > F
PERFORM FOUND-THIS.
Choice 3
IF A NOT LESS B
IF C NOT EQUAL D
IF E NOT GREATER F
PERFORM FOUND-THAT.
Choice 4
IF A >= B
IF C <> D
IF E <= F
PERFORM FOUND-THAT.
Choice 5
IF A IS LESS THAN B
IF C IS NOT EQUAL TO D
IF E IS NOT GREATER THAN F
PERFORM FOUND-THIS.
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.67.
01 FIELDC
PIC S9(1)V9(4) COMP-3 VALUE +1.23.
01 RESULT-ONE
PIC S9(5)V9(2) COMP-3.
01 RESULT-TWO
PIC S9(5)V9(4) COMP-3.
PROCEDURE DIVISION.
COMPUTE RESULT-ONE RESULT-TWO = FIELDA / FIELDB *
FIELDC.
Considering that truncation will occur, upon
execution of the sample code above, the field FINALRESULT contains which one of the following sets of
values?
Choice 1
V82 and V8283
Choice 2
V82 and V8282
Choice 3
V82 and V82
Choice 4
V82 and V8249
Choice 5
V82 and 8250
Which one of the following does the RENT compiler
option specify about a batch COBOL II program?
Choice 1
Re-entrant and eligible to be loaded in the LPA
Choice 2
Run in subpool 1 storage
Choice 3
Pre-loadable
Choice 4
Allocate a TGT area
Choice 5
Serially re-usable
WORKING-STORAGE SECTION.
01 NPA-TABLE.
05
PIC S9(5) PACKED-DECIMAL
VALUE ZERO.
05 NETWORK-PLANNING-AREA.
10 NPA-ENTRY OCCURS 6 TIMES PIC S9(5) COMP-3.
PROCEDURE DIVISION.
.....
MOVE NPA-TABLE TO NETWORK-PLANNING-AREA.
Which one of the following values is contained in
each occurrence of NPA-ENTRY after the statement shown
in the sample code above is executed?
Choice 1
Unsigned zeros
Choice 2
Garbage
Choice 3
Unpredictable results
Choice 4
Zeros
Choice 5
Nulls
WORKING-STORAGE SECTION.
77 A-COUNT1 PIC S99 VALUE 1.
...
PROCEDURE DIVISION.
PERFORM A0100-PROCESS-RECS
UNTIL A-COUNT1 IS GREATER THAN +10
END-PERFORM.
EXIT PROGRAM.
A0100-PROCESS-RECS.
ADD +2
TO A-COUNT1.
Referring to the sample code above, how many times is
A0100 executed?
Choice 1
One time
Choice 2
Four times
Choice 3
Five times
Choice 4
Six times
Choice 5
Ten times
WORKING-STORAGE SECTION.
01 S04-RECORD.
05 S04-MBN PIC X(4).
12
Line 8
Choice 4
Line 9
Choice 5
This code meets the program requirements.
Which one of the following describes how an FD (File
Descriptor) and an RD (Report Descriptor) are related
to one another?
Choice 1
Both statements refer to the same SELECT/ASSIGN
statement.
Choice 2
The RD should be placed immediately under the FD it is
related to.
Choice 3
A FILE IS clause is added to the RD statement in order
to link the two.
Choice 4
Both the FD and RD have the same name following them.
Choice 5
A REPORT IS clause is added to the FD statement to
link the two.
24.
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 (8: ) 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
6bbb
Choice 2
bbb6
Choice 3
b695
Choice 4
695b
Choice 5
7695
01
NPA-ARRAY.
05 NPA OCCURS 1000 TIMES PIC 999.
Referring to the sample code above, and assuming the
possibility of looking for any particular entry in the
table is equal, which one of the following search
methods performs best?
Choice 1
A binary search
Choice 2
A serial search
Choice 3
A partitioned search
Choice 4
Sequential IF statements checking for each possible
value
Choice 5
A serialized binary search
01 NICKNAME
13
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
WOOKIEbbbbb
Choice 2
WOOKbbbbbbb
Choice 3
SNOOKIEbbbb
Choice 4
WICKIEWOCKb
Choice 5
SNOOKIEPOOH
05 FIELDA PIC X(132) VALUE ALL '*'.
...
INITIALIZE FIELDA.
Which one of the following values is contained in
FIELDA following execution of the statement in the
sample code above?
Choice 1
Spaces
Choice 2
Numeric zeros
Choice 3
Zeros
Choice 4
Nulls
Choice 5
Asterisks
100 IF EMPLOYEE-CLASS = '01'
200
IF EMPLOYEE-TYPE = 'SE'
300
PERFORM SPECIAL-EMPLOYEE
400
ELSE
500
NEXT SENTENCE
600
END-IF
700
PERFORM SPECIAL-CLASS
800 END-IF.
900 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
following execution of paragraph SPECIAL-EMPLOYEE?
Choice 1
400
Choice 2
600
Choice 3
700
Choice 4
800
Choice 5
900
0120
WHEN CALIFORNIA
0130
IF TAX-REBATE
0140
PERFORM HANDLE-TAX-REBATE THRU PRINTCHECK
0150
ELSE
0160
PERFORM TAX-COUNTER-ROUTINE
0170
END-IF
0180
WHEN NEW-YORK
0100
IF TAX-REBATE
0200
PERFORM CALC-REBATE-DUE
0210
ELSE
0220
PERFORM CALC-TAX-DUE
0230
END-IF
0240
WHEN OTHER
0250
PERFORM CALC-OTHER-TAX
0260 END-EVALUATE.
Referring to the sample code above, assume TAX-REBATE
is true, and further assume that CALIFORNIA and NEWYORK are FALSE. Which one of the following paragraphs
is executed?
Choice 1
CALC-REBATE-DUE
Choice 2
CALC-TAX-DUE
Choice 3
HANDLE-TAX-REBATE THRU PRINT-CHECK
Choice 4
TAX-COUNTER-ROUTINE
Choice 5
CALC-OTHER-TAX
In the REPORT GROUP Entry Description, which one of the
following is NOT an acceptable TYPE clause?
Choice 1
PAGE FOOTING
Choice 2
CONTROL FOOTING
Choice 3
GROUP HEADING
Choice 4
DETAIL
Choice 5
REPORT HEADING
IDENTIFICATION DIVISION.
PROGRAM-ID. MI030095.
....
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WORK-FIELDA PIC XXX.
01 WORK-FIELDB PIC S9(4).
01 WORK-FIELDC PIC A(1).
....
PROCEDURE DIVISION.
....
CALL 'MI03A095' USING WORK-FIELDA
WORK-FIELDB
WORK-FIELDC.
....
IDENTIFICATION DIVISION.
PROGRAM-ID. MI03A095.
....
LINKAGE SECTION GLOBAL.
01 WORK-FIELDB PIC X.
01 WORK-FIELDA PIC X.
01 WORK-FIELDC PIC X.
PROCEDURE DIVISION USING WORK-FIELDC
WORK-FIELDB
WORK-FIELDC.
....
14
NPA-ARRAY.
05 NPA OCCURS 10 TIMES PIC 999.
Referring to the sample code above, and assuming the
possibility of looking for any particular entry in the
table is equal, which one of the following search
methods performs best?
Choice 1
A partitioned search
Choice 2
A binary search
Choice 3
A serial search
Choice 4
A serialized binary search
Choice 5
Sequential IF statements checking for each possible
value
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.
In the sample code above, if employee-class is equal
to '01' and employee-type is NOT equal to 'SE', which
one of the following statements is executed?
Choice 1
0400
Choice 2
0500
Choice 3
0600
Choice 4
0800
Choice 5
1100
0100 INITIAL-READ.
0110
READ MASTER-FILE
0120
AT END MOVE 'Y' TO MASTER-EOF-SW.
0130
READ TRANSACTION-FILE
0140
AT END MOVE 'Y' TO TRANSACTION-EOF-SW.
0150
PERFORM PROCESS-FILE
0160
UNTIL END-OF-MASTER OR
0170
END-OF-TRANSACTIONS.
0180
GOBACK.
0190 PROCESS-FILE.
0200
PERFORM UNTIL MASTER-KEY >= TRANSACTION-KEY
0210
WRITE MASTER-RECORD
0220
READ MASTER-RECORD AT END MOVE 'Y' TO
MASTER-EOF-SW
0230
END-PERFORM.
0240
...
0250 DELETE-MASTER.
0260
...
0270 ADD-MASTER.
0280
...
0290 UPDATE-MASTER.
0300
...
This is a tape-based master-transaction program
segment. Referring to statements #0200 through #0230,
what condition is trapped by continuously reading the
master file until its key is equal to or greater than
the transaction file key?
Choice 1
This code processes master records remaining after the
other has encountered end-of-file.
Choice 2
This code processes the remaining transaction records
when the master file ends first.
Choice 3
This code resequences the master file.
Choice 4
This code processes the remaining transaction records
when the master file starts first.
Choice 5
This code traps the condition where there are no
transactions for one or more master records.
36.
Which one of the following statements is NOT
permissible in COBOL II?
Choice 1
INSPECT field REPLACING ALL value BY value
Choice 2
15
Choice 3
The ENTRY statement provides an alternate entry point
into a COBOL called program or subprogram.
Choice 4
The ENTRY statement establishes an alternate entry
point into a COBOL called program.
Choice 5
The ENTRY statement establishes an alternate entry
point into a COBOL called subprogram.
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 USING FIELDA, FIELDB, FIELDC.
Choice 3
PROCEDURE DIVISION USAGE IS FIELDA, FIELDB, FIELDC.
Choice 4
PROCEDURE DIVISION USING FIELDC, FIELDB, FIELDA.
Choice 5
PROCEDURE DIVISION INCOMING FIELDA, FIELDB, FIELDC.
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
COBOL II, Question 1 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
PIC S9(..)
Choice 4
FILLER or index items
Choice 5
PIC ZZ,ZZ9.99
Which one of the following contains the four DIVISIONS
used in COBOL?
16
Choice 1
Identification
Data
Linkage
Procedure
Choice 2
Identification
Environment
Data
Procedure
Choice 3
Identification
Environment
Working-Storage
Procedure
Choice 4
Identification
Input-Output
Data
Procedural
Choice 5
Identification
Configuration
Working Storage
Procedure
0100
0200
0300
0400
0500
0600
0700
0800
0900
1000
1100
In
IF EMPLOYEE-CLASS = '01'
IF EMPLOYEE-TYPE = 'SE'
IF EMPLOYEE-AGE > 50
PERFORM PERFORM BONUS-APPLICATION
END-IF
ELSE
PERFORM SPECIAL-EMPLOYEE
END-IF
PERFORM SPECIAL-CLASS
END-IF.
PERFORM NEXT-TASK.
the sample code above, if
Choice
b695
Choice
769b
Choice
b769
Choice
7695
2
3
4
5
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 FIELD1 is signed and the PICTURE
clause is unsigned.
Choice 4
The VALUE clause for FIELD3 is unsigned and the
PICTURE clause is signed.
Choice 5
The VALUE clause for FIELD2 is signed and the PICTURE
clause is signed.
COBOL II, Question 11 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
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
Line 0200 should be Program-ID. AM820115.
Choice 3
NAME should not be capitalized.
Choice 4
Line 0200 should be Program-Identification. AM820115.
Choice 5
17
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-NNX
Choice 2
SORT-TN
Choice 3
SORT-BILL-TO-RECORD
Choice 4
SORT-NPA
Choice 5
SORT-BTN
WORKING-STORAGE SECTION.
01 ZZ-TOP PIC S9 COMP-3 VALUE +9.
PROCEDURE DIVISION.
...
ADD +1 TO ZZ-TOP.
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
W-TOTAL-AMT / W-NUM-RECS = W-AVG-AMT.
Choice 3
DIVIDE W-TOTAL-AMT INTO W-NUM-RECS
GIVING W-AVG-AMT.
Choice 4
DIVIDE W-AVG-AMT INTO W-TOTAL-AMT.
Choice 5
W-TOTAL-AMT DIVIDED BY W-NUM-RECS EQUALS W-AVG-AMT.
FILE SECTION.
FD INPUT-CALL-DETAIL-FILE
RECORD CONTAINS 13 CHARACTERS.
01 I-BILL-TO-RECORD.
05 I-BTN
PIC X(13).
...
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
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. [not sure]
Choice 2
It is an efficient tool to use during initial compiler
debugging phases.
Choice 3
It provides the ability to select whether compilation
is aborted while debugging.
Choice 4
18
19
05
05
05
05
05
WORK-FIELDA
WORK-FIELDB
WORK-FIELDC
WORK-FIELDD
WORK-FIELDE
PIC
PIC
PIC
PIC
PIC
ZZ9.
XXX.
XXBXXX.
$$$Z9.99.
999.
...
INITIALIZE WORK-AREA REPLACING ALPHANUMERIC-EDITED BY
ZEROS.
Which one of the following fields, if any, will be
INITIALIZEd by the statement in the sample code above?
Choice 1
WORK-FIELDD
Choice 2
WORK-FIELDE
Choice 3
WORK-FIELDB
Choice 4
WORK-FIELDA
Choice 5
WORK-FIELDC[not sure]
WORKING-STORAGE SECTION.
01 AFIELD PIC S9(3) COMP-3 VALUE +981.
01 BFIELD PIC S9(3) COMP-3 VALUE +017.
PROCEDURE DIVISION.
ADD AFIELD TO BFIELD.
MULTIPLY 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
+8
Choice 2
+38
Choice 3
+79038
Choice 4
+79938
Choice 5
+979038
FD O-REPORT-FILE.
01 O-REPORT-REC.
05 O-REPORT-HDR
05
05 O-REPORT-DATE.
10 O-REPORT-MM
10 O-REPORT-YY
05 O-REPORT-TIME
PIC X(40).
PIC X(02) VALUE SPACES.
PIC X(03).
PIC X(02).
PIC X(08).
01 WORK-AREAS.
05 W-DATE PIC X(08) VALUE '08/17/06'.
05 W-TIME PIC X(08) VALUE '03:10:44'.
Program Sample:
1) MOVE 'WORK HISTORY REPORT FOR: ' TO O-REPORT-HDR
2) MOVE W-DATE (1:3) TO O-REPORT-MM
3) MOVE W-DATE (4:2) TO O-REPORT-YY
4) MOVE W-TIME (1:5) TO O-REPORT-TIME
When a page break occurs, a new heading is printed
which includes the date and time as specified below.
Which lines of code above prevent this from being
produced correctly?
Date 08/06 or MM/YY
Time 03:10:44 or HH:MM:SS
WORK-AREA.
20
Choice 1
Line 1
Choice 2
Line 2
Choice 3
Lines 2 and 3
Choice 4
Lines 3 and 4
Choice 5
Line 4
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. s
...
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
All fields are moved.
Choice 4
FIELDA and AREA-INDEX are the only fields moved.
Choice 5
FIELDA and ARRAY are the only fields moved.
Which one of the following is one of the standard
clauses used with the COPY statement?
Choice 1
REPLACING
Choice 2
ALL
Choice 3
UNTIL
Choice 4
FROM
Choice 5
MEMBER
INITIALIZE has NO effect on which one of the following
types of fields?
Choice 1
PIC ZZ,ZZ9.99
Choice 2
PIC S9(..) COMP-3
Choice 3
PIC S9(..)
Choice 4
FILLER or index items
Choice 5
PIC 9(..)
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
Scenario
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
ADVANCE RPT-FILE PAGE
WRITE RPT-HEADER
Choice 3
WRITE RPT-RCD FROM RPT-HEADER BEFORE ADVANCING PAGE
Choice 4
WRITE RPT-RCD AFTER ADVANCING FROM RPT-HEADER
Choice 5
WRITE RPT-RCD FROM RPT-HEADER AFTER ADVANCING PAGE
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
FROM TOTAL-AMT.
Choice 1
-29.8
Choice 2
49.65
Choice 3
89.8
Choice 4
92
Choice 5
149.65
INTEREST-AMT
21
Choice 4
FD INPUT-FILE.
COPY MEMBER IRECORD.
Choice 5
FD INPUT-FILE.
COPY IRECORD.
IDENTIFICATION DIVISION.
PROGRAM-ID. AM82P001 IS COMMON.
....
PROCEDURE DIVISION.
...
CALL 'AM82P002'.
GOBACK.
END PROGRAM AM82P001.
IDENTIFICATION DIVISION.
PROGRAM-ID. AM82P002.
...
PROCEDURE DIVISION.
...
CALL 'AM82P003'.
EXIT PROGRAM.
END PROGRAM AM82P002.
IDENTIFICATION DIVISION.
PROGRAM-ID. AM82P003 IS COMMON.
...
PROCEDURE DIVISION.
...
MOVE 'X' TO SERVICE-AND-EQUIPMENT.
...
STOP RUN.
END PROGRAM AM82P003.
Which one of the following states why the COMMON
clause in the sample code above is coded
incorrectly?
Choice 1
COMMON may only be coded in a contained program.
Choice 2
EXIT PROGRAM nor STOP RUN may be used in a nested
program unless the COMMON clause is
coded.
Choice 3
The COMMON clause can only be coded on the PROGRAM-ID
of a program to increase the scope
of programs that it can call.
Choice 4
When COMMON is coded on a PROGRAM-ID clause of a
contained program, the contained
ON SIZE ERROR
DISPLAY FINAL-RESULT.
Upon execution of the sample code above, the field
FINAL-RESULT contains which one of the
following values when displayed?
Choice 1
0
Choice 2
13V20
Choice 3
32V00
Choice 4
50V00
Choice 5
132V00
IF A NOT < B
IF C NOT = D
IF E NOT > F
PERFORM FOUND-THIS.
Which one of the following is the code segment in the
scenario above equivalent to?
Choice 1
EVALUATE TRUE
WHEN A GREATER THAN B ALSO C <> D ALSO E <= F
PERFORM FOUND-THIS
END-EVALUATE.
Choice 2
IF A <= B
IF C <> D
IF E NOT > F
PERFORM FOUND-THIS.
Choice 3
EVALUATE TRUE
WHEN A > B ALSO C <> D ALSO E <= F
PERFORM FOUND-THIS
END-EVALUATE.
Choice 4
IF A IS LESS THAN B
IF C IS NOT EQUAL TO D
IF E IS NOT GREATER THAN F
PERFORM FOUND-THIS.
Choice 5
EVALUATE TRUE
WHEN A >= B ALSO C <> D ALSO E <= F
PERFORM FOUND-THIS
END-EVALUATE.
05 S-ERROR-CHECK
PIC X(01).
88 S-ERROR-OCCURRED
VALUE 'Y'.
88 S-NO-ERROR-OCCURRED
VALUE 'N'.
05 S-LINE-COUNT PIC S9(3) COMP-3.
1) S0500-ERROR-VERIFICATION.
2)
IF S-NO-ERROR-OCCURRED
3)
PERFORM S0900-WRITE-ERROR-REC
4)
SET S-NO-ERROR-OCCURRED TO TRUE
5)
MOVE ZERO TO S-LINE-COUNT
6)
ELSE
7)
PERFORM S1000-WRITE-REPORT-LINE
8)
ADD +1 TO S-LINE-COUNT
9)
END-IF.
Code in the Error Verification section must write a
record to the error report and must reset the
error switch if any errors have occurred in the
program. Which one of the following lines in the
22
23
01
01
DATA-ITEM-2.
05 ITEM-A PIC 99.
05 ITEM-B PIC +9V9.
05 ITEM-C PIC A(4).
05 ITEM-D PIC 9(4).
05 ITEM-E USAGE IS COMP.
05 ITEM-F USAGE IS INDEX.
X PIC 9.
PROCEDURE DIVISION.
PERFORM VARYING X FROM 1 BY 1 UNTIL X > 6
ADD CORRESPONDING DATA-ITEM-2 TO DATA-ITEM-1
(X)
END-PERFORM.
Referring to the sample code above, which one of the
following sets of fields in DATA-ITEM-2
are added to the fields in DATA-ITEM-1?
Choice 1
ITEM-A
ITEM-B
ITEM-E
Choice 2
ITEM-A
ITEM-B
Choice 3
ITEM-A
ITEM-B
ITEM-D
Choice 4
ITEM-A
ITEM-E
Choice 5
ITEM-A
ITEM-B
ITEM-D
ITEM-E
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
Formula
* W-RATE * (W-HRS-WORKED -
W-RATE X (W-HRS-WORKED -
W-RATE * W-HRS-WORKED
W-RATE * (W-HRS-WORKED -
W-RATE * W-HRS-WORKED)
In calling program:
01 WK-DAYS
PIC S9(9) BINARY.
01 WK-YYYYMMDD.
02 WK-YYYY
PIC X(4).
02 WK-MM
PIC X(2).
02 WK-DD
PIC X(2).
In called program GETDAYS:
LINKAGE SECTION.
01 LK-YYYYMMDD.
05 LK-YYYY
PIC X(04).
05 LK-MM
PIC X(02).
05 LK-DD
PIC X(02).
01 LK-DAYS
PIC S9(9) BINARY.
PROCEDURE DIVISION USING LK-YYYYMMDD LK-DAYS.
Assuming the sample code above is part of the program
GETDAYS, which one of the following is a
valid CALL to GETDAYS?
24
Choice 2
ARRAY (1, 2, 1)
ARRAY (1, 2, 2)
ARRAY (1, 2, 1)
ARRAY (1, 2, 2)
Choice 3
ARRAY (1, 1, 1)
ARRAY (1, 1, 2)
ARRAY (2, 2, 1)
ARRAY (2, 2, 2)
Choice 4
ALL is not a valid subscript or index.
Choice 5
ARRAY (2, 1, 1)
ARRAY (2, 1, 2)
ARRAY (2, 2, 1)
ARRAY (2, 2, 2)
A batch program has been written to post transactions
to a Master File. Unfortunately, the
programmer who wrote the module did not request the
file status clause in the SELECT statement.
The module abends at a mission-critical point in time,
with a VSAM error producing a standard
dump.
Referring to the scenario above, at which one of the
following locations is the file status
information located within the FCB printed in the
storage dump?
Choice 1
At hexadecimal displacement 'A3'
Choice 2
At hexadecimal displacement 'A4'
Choice 3
At hexadecimal displacement 'B3'
Choice 4
At hexadecimal displacement 'B9'
Choice 5
At hexadecimal displacement 'C4'
25
...
INSPECT FIELDA TALLYING COUNTER FOR CHARACTERS BEFORE
INITIAL ','.
Which one of the following is the value of COUNTER
following execution of the INSPECT
statement in the sample code above?
Choice 1
5
Choice 2
6
Choice 3
7
Choice 4
8
Choice 5
9
DATA DIVISION.
WORKING-STORAGE SECTION.
01 FLOATING-INSERTION-EDITS.
05 FIELDA PIC S9(5) COMP-3 VALUE +12345.
05 FIELDB PIC $,$$$,$$$.99.
05 FIELDC PIC +,+++,+++.++.
05 FIELDD PIC $ZZZ,ZZZ.99.
PROCEDURE DIVISION.
MOVE FIELDA TO FIELDB
FIELDC
FIELDD.
Which one of the following represents the final
values of FIELDB, FIELDC, and FIELDD after
execution of the sample code above?
NOTE: 'b' represents blank
Choice 1
FIELDB = bb$12,345.00
FIELDC = bb+12,345.00
FIELDD = b$b12,345.00
Choice 2
FIELDB = b$b12,345.00
FIELDC = b+b12,345.00
FIELDD = $bb12,345.00
Choice 3
FIELDB = $b12,345.00
FIELDC = +b12,345.00
FIELDD = $b12,345.00
Choice 4
FIELDB = $$12,345.00
FIELDC = bb+12,345.00
FIELDD = $bb12,345.00
Choice 5
FIELDB = $,$12,345.00
FIELDC = b,+12,345.00
FIELDD = $b,b12,345.00
01 NPA-ARRAY.
05 NPA OCCURS 25 TIMES PIC 999.
Referring to the sample code above, which one of the
following search methods performs fastest,
giving due consideration to the number of entries to be
searched?
Choice 1
A partitioned search
Choice 2
A binary search
Choice 3
A serial search
Choice 4
READ INPUT-MASTER-FILE
INVALID KEY
PERFORM 999-ABEND-ROUTINE
NOT INVALID KEY
MOVE 'Y' TO IMF-PAID-SW.
REWRITE INPUT-MASTER-RECORD
INVALID KEY
PERFORM 999-ABEND-ROUTINE.
ASSUME:
- All working storage fields required have been defined
- All performed paragraphs exist
- The open is successful
Which one of the following statements correctly
describes what, if anything, is WRONG in the
above segment of code?
Choice 1
The file was not opened I-O.
Choice 2
The file was not opened for output.
Choice 3
The read statement did not specify the KEY phrase.
Choice 4
The rewrite statement should rewrite INPUT-MASTERFILE.
Choice 5
The file was not opened EXTEND.
05 IN-NAME PIC X(3) VALUE 'TOM'.
....
DISPLAY FUNCTION LOWER-CASE(IN-NAME (2: )).
Which one of the following sets lists the (a) content
of FIELDA and (b) value displayed, following
execution of the sample code above?
Choice 1
(a) oM
(b) oM
Choice 2
(a) om
(b) om
Choice 3
(a) TOM
(b) oM
Choice 4
(a) TOM
(b) Tom
Choice 5
(a) Tom
26
(b) om
01 DATA-FIELD
01 TALLY-FIELD
PROCEDURE DIVISION.
ACCEPT COMPLETE-NAME FROM COMMAND-LINE.
MOVE COMPLETE-NAME (LNM-POINTER: ) TO LAST-NAME.
...
When using reference modification with a MOVE
statement, a pointer to the starting position for the
move is required and the length value is optional. In
order to make the MOVE statement in the scenario above
work, what else do you need to do?
Choice 1
COMPLETE-NAME should be defined with an OCCURS clause.
Choice 2
An index must be set to point to LAST-NAME.
Choice 3
Set LNM-POINTER to point to the first character of the
last name.
Choice 4
Nothing.
Choice 5
The ADDRESS OF the field LAST-NAME must be specified.
Main routine....
CALL subroutine USING BY CONTENT 'OHIO'.
Subroutine....
LINKAGE SECTION.
01 PASSED-FIELD PIC X(5).
PROCEDURE DIVISION USING PASSED-FIELD.
IF PASSED-FIELD = 'OHIO'
.....
Passing a literal BY CONTENT that is shorter in the
calling program than its definition in the called
program is risky. Which one of
the following occurs as a result of the compare shown
above?
Choice 1
Protection exception
Choice 2
Data exception [not sure]
Choice 3
Decimal divide exception
Choice 4
Operation exception
Choice 5
Unpredictable results
27
Choice 3
Look for displacement 001208 in the DUMP section in
the SYSOUT for the job.
Choice 4
Search for '1208' in the load module for FRG0253.
Choice 5
Look in the cross reference from
FRG0253 for displacement 001208.
Field in working storage:
05 S-PLAYER-FILE-CHECK
88 S-PLAYER-FILE-NOT-EOF
88 S-PLAYER-FILE-EOF
05 S-TEAM-FILE-CHECK
88 S-TEAM-FILE-NOT-EOF
88 S-TEAM-FILE-EOF
05 S-TEAM-TOTALS-CHECK
88 S-TEAM-TOTALS-NOT-DONE
88 S-TEAM-TOTALS-DONE
the compile of
PIC X(01).
VALUE 'N'.
VALUE 'Y'.
PIC X(01).
VALUE 'N'.
VALUE 'Y'.
PIC X(01).
VALUE 'N'.
VALUE 'Y'.
Choice 4
SEARCH ALL ITEM-COST
WHEN ITEM-CD(COST-TABLE-INDEX) = WK-ITEM-CD
MOVE ITEM-COST(COST-TABLE-INDEX) TO WK-COST
END-SEARCH.
1) MAINLINE.
2)
3)
4)
SET S-PLAYER-FILE-NOT-EOF
SET S-TEAM-FILE-NOT-EOF
SET S-TEAM-TOTALS-NOT-DONE
Choice 5
SEARCH ALL COST-TABLE-INDEX
WHEN ITEM-CD(COST-TABLE-INDEX) = WK-ITEM-CD
MOVE ITEM-COST(COST-TABLE-INDEX) TO WK-COST
END-SEARCH.
5)
5)
5)
PERFORM S0100-PROCESS-PLAYER-FILE
UNTIL S-PLAYER-FILE-EOF
END-PERFORM
6)
6)
6)
PERFORM S0200-PROCESS-TEAM-FILE
UNTIL S-TEAM-FILE-EOF
END-PERFORM
TO TRUE
TO TRUE
TO TRUE
7)
7)
7)
PERFORM S0400-PRINT-TEAM-TOTALS
UNTIL S-TEAM-FILE-EOF
END-PERFORM
.
The statement numbers for the perform are for all
three lines of the perform.
A logic error is occurring in the Working Storage and
Mainline section of the sample code above. Which one of
the following statements
do you modify to correct the problem?
Choice 1
Line 2
Choice 2
Line 4
Choice 3
Line 5
Choice 4
Line 6
Choice 5
Line 7
MOVE FIELDA (PTR) TO PTR, FIELDB (PTR).
The sample code shown above is equivalent to
which one of the following?
Choice 1
MOVE FIELDA (PTR) TO TEMP.
MOVE TEMP TO PTR.
28
(PTR).
(PTR) TO TEMP.
(PTR).
(PTR) TO TEMP.
(TEMP).
(PTR) TO TEMP.
(PTR).
(TEMP) TO PTR.
(PTR).
123456789012345678901234567890...
"THIS IS A VALID COMMENT"
//STEP001 EXEC PGM=KFG00257
//IOIN
DD DSN=CORP.MASTERS(LOCKS),DISP=SHR
//IOOUT DD DSN=CORP.NEW.MASTERS(NEWLOCKS),DISP=OLD
Which of the following SELECT statements works for
the above JCL?
Choice 1
SELECT IOIN ASSIGN TO LOCKS.
SELECT IOOUT ASSIGN TO NEWLOCKS.
Choice 2
SELECT LOCKS ASSIGN TO IOIN.
SELECT NEWLOCKS ASSIGN TO IOOUT.
Choice 3
SELECT IOIN ASSIGN TO IOIN.
SELECT IOOUT ASSIGN TO IOOUT.
Choice 4
SELECT LOCKS ASSIGN TO AS-IOIN.
SELECT NEWLOCKS ASSIGN TO AS-IOOUT.
Choice 5
SELECT IOIN ASSIGN TO AS-LOCKS.
SELECT IOOUT ASSIGN TO AS-NEWLOCKS.
29
Choice 1
FD MASTER-FILE.
01 MASTER-RECORD PIC X(100).
01 MASTER-KEY PIC X(10).
Choice 2
FD MASTER-FILE
RECORD CONTAINS 100 CHARACTERS.
01 MASTER-RECORD PIC X(100).
Choice 3
FD MASTER-FILE.
01 MASTER-RECORD PIC X(100).
Choice 4
FD MASTER-FILE
RECORD CONTAINS 100 CHARACTERS.
01 FILLER PIC X(100).
Choice 5
FD MASTER-FILE.
01 MASTER-RECORD.
05 MASTER-KEY PIC X(10).
05 MASTER-DATA PIC X(90).
01
01
01
01
01
NOT-FILLER
PIC X.
WORKING-STORAGE
PIC X.
01-X
PIC X.
THIS-IS-A-VERY-LONG-NAME PIC X.
I
PIC X.
Which of the following statements concerning the
above code is correct?[Incorrect shud be the ques]
Choice 1
01 I PIC X.
is invalid since I must be defined as numeric.
Choice 2
01 THIS-IS-A-VERY-LONG-NAME PIC X.
is invalid since the dataname is longer than 20
characters.
Choice 3
01 01-X PIC X.
is invalid since the dataname cannot start with a
number.
Choice 4
01 NOT-FILLER PIC X.
is invalid since FILLER must not be combined with other
words.
Choice 5
01 WORKING-STORAGE PIC X.
is invalid since WORKING-STORAGE is a reserved word.
Which one of the following factors does the RENT
compiler option specify about a batch COBOL II program?
Choice 1
It is pre-loadable.
Choice 2
Re-entrant and eligible to be loaded in the LPA
Choice 3
It is serially re-usable.
Choice 4
It runs in subpool 1 storage.
Choice 5
It allocates a TGT area.
01 DATA-FIELD
PIC X(20) VALUE 'John
Johnson'.
01 NAME1
PIC X(10) VALUE SPACES.
01 NAME2
PIC X(10) VALUE SPACES.
01 NAME3
PIC X(10) VALUE SPACES.
01 TALLY-FIELD
PIC 9(3) VALUE 1.
PRICE-TABLE.
05 PRICE-GROUP
10 ITEM-CODE
10 ITEM-PRICE
10 ITEM-LOC
OCCURS 50 TIMES.
PIC X(7).
PIC 99V99.
PIC X(3).
30
READ MASTER-DATE.
MOVE SYSDATE-RECORD TO MASTDATE-RECORD.
WRITE MASTDATE-RECORD.
CLOSE SYSTEM-DATE
MASTER-DATE.
What is WRONG in the above code?
Choice 1
WRITE MASTER-DATE needs to be replaced with REWRITE
MASTER-DATE.
Choice 2
MASTER-DATE needs to be opened as OUTPUT, not I-O.
Choice 3
SYSTEM-DATE needs to be opened as INPUT, not I-O.
Choice 4
The files were closed before reading to EOF.
Choice 5
SYSDATE is a reserved word.
ISPF Screen:
COMMAND ===>
=BNDS>
<
>
000153 * SALES RECORD FOLLOWS
000154 01 SALES-TOTALS.
000155
05 ST-SALES-YTD
PIC
000156 * FOLLOWING CODES ARE USED:
000157 *
000158 *
ISLANDS
000159
05 ST-NA-YTD
PIC
000160
05 ST-SA-YTD
PIC
000161
05 ST-AI-YTD
PIC
000178 *
9(7)V99.
NA = NORTH ALASKA
SA = SOUTH ALASKA
AI = ALEUTIAN
9(7)V99.
9(7)V99.
9(7)V99.
static call.
Choice 4
CALL WS-PROGNAME. always results in a dynamic call;
CALL 'PROGNAME'. results in a dynamic call if the DYNAM
compiler option
is used.
Choice 5
CALL WS-PROGNAME. results in a dynamic call if the
DYNAM compiler option is used; CALL 'PROGNAME'. always
results in a
Choice 2
Line 154
Choice 3
Line 155
dynamic call.
SELECT SYSTEM-DATE ASSIGN TO SYSDATE.
SELECT MASTER-DATE ASSIGN TO MASTDATE.
...
FD SYSTEM-DATE.
01 SYSDATE-RECORD
PIC X(10).
FD MASTER-DATE.
01 MASTDATE-RECORD
...
PROCEDURE DIVISION.
OPEN I-O SYSTEM-DATE
MASTER-DATE.
READ SYSTEM-DATE.
PIC X(10).
Choice 4
Line 157
Choice 5
Line 160
DATA DIVISION.
WORKING-STORAGE SECTION.
01 COMPLETE-NAME
PIC X(30).
01 LAST-NAME
PIC 9(15).
01 LNM-POINTER
PIC S999 COMP-3.
PROCEDURE DIVISION.
...
MOVE COMPLETE-NAME (LNM-POINTER: ) TO LAS
...
31
T-NAME.
IDENTIFICATION DIVISION.
PROGRAM-ID.
ABCD3000.
DATA DIVISION.
4)
5)
WORKING-STORAGE SECTION.
01 W-PLAYER-RECORD-AREA
PIC X(120).
6)
7)
8)
LINKAGE SECTION.
01 L-PLAYER-NAME
01 L-PLAYER-AVG
PIC X(30).
PIC 9(03).
9)
32