You are on page 1of 32

Q.

01)
01 IF EMPLOYEE-CLASS = '01'
02 IF EMPLOYEE-TYPE = 'SE'
03 PERFORM SPECIAL-EMPLOYEE
04 ELSE
05 NEXT SENTENCE
06 END-IF
07 PERFORM SPECIAL-CLASS
08 ELSE
09 PERFORM MANAGER-CLASS
10 IF EMPLOYEE-TYPE = 'SE'
11 PERFORM SPECIAL-EMPLOYEE
12 END-IF
13 END-IF.
14 PERFORM GET-NEXT-EMPLOYEE

Referring to the same code above, if:


employee-class='01'
employee-type='XE'

Which perform statement is execuTed?

a) 03
b) 07
c) 09
d) 11
*e) 14

Q.02)
W-TOTAL-STUDENTS =Total number of students is 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 who are required to stay with the students who will NOT be
attending
the trip because they do NOT have permission slips?

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


b) W-TOTAL-TEACHERS = W-TOTAL-STUDENTS - W-TOTAL-PERMISSION / 10
c) W-TOTAL-STUDENTS - W-TOTAL-PERMISSION)/10 GIVING W-TOTAL-TEACHERS
*d) COMPUTE W-TOTAL-TEACHERS ROUNDED = ((W-TOTAL-STUDENTS - W-TOTAL-PERMISIION) /
10) + 0.5
e) W-TOTAL-TEACHERS = (W-TOTAL-STUDENTS - W-TOTAL-PERMISSION) / 10

Q.03)
150* MOVE 1 TO YEAR-COUNTER.
151 PERFORM 120-CALC-NEXT-FV
152 UNTIL YEAR-COUNTER > NUMBER-OF-YEARS.
In the code above, line 150 is commented out. If this specific change causes a run-
time error
on the UNTIL clause, which one of the following is the most likely exception?
a) 0C1 Operation exception.
b) 0C4 Protection exception.
c) 0C5 Addressing exception.
*d) 0C7 Data exception.
e) 0CA Decimal-overflow exception.
Q.04)
01 TODAYS-DATE PIC 9(8).
Which one of the following ACCEPT statements properly loads the current
date to TODAYS-DATE with four digit year?
A) ACCEPT DATE INTO TODAYS-DATE.
B) ACCEPT CURRENT-DATE INTO TODAYS-DATE.
C) ACCEPT TODAYS-DATE FROM CURRENT-DATE.
*D) ACCEPT TODAYS-DATE FROM DATE YYYYMMDD.
E) ACCEPT TODAYS-DATE FROM DATE.

Q.05)
01 NOT-FILLER PIC X.
01 WORKING-STORAGE PIC X.
01 01-X PIC X.
01 THIS-IS-A-VERY-LONG-NAME PIC X.
01 I PIC X.

Which of the following statements concerning the above code is correct?


a) 01 I PIC X
is invalid since I must be defined as a numeric.
*b) 01 WORKING-STORAGE PIC X.
is invalid since WORKING-STORAGE is reserved word.
c) 01 THIS-IS-A-VERY-LONG-NAME PIC X.
is invalid since the dataname is longer than 20 characters.
d) 01 01-X PIC X.
is invalid since the dataname cannot start with number.
e) 01 NOT-FILLER PIC X.
is invalid since FILLER must not be combined with other words.

Q.06)
05 ID-VALUE PIC X(01).
88 NO-ID VALUE SPACES.
Which of the following is NOT a valid 88 level subordinate to ID-VALUE in the above
code?

a) 88 ID-IS VALUE IS 'I''S'.


b) 88 ID-XYZ VALUE 'X' THROUGH 'Z'.
c) 88 ID-NBR VALUE '1'.
d) 88 ID-ERR VALUE 'D' THRU 'F'.
*e) 88 ID-XX VALUE 'XX'.

Q.07)
SELECT INPUT-MASTER-FILE ASSIGN TO IMASTER
ORGANIZATION IS INDEXED
ACCESS MODE IS SEQUENTIAL
RECORD KEY IS IMF-BILLING-TELENO.
...
FD INPUT-MASTER-FILE
01 INPUT-MASTER-RECORD.
05 IMF-BILLING-TELENO PIC X(10).
05 IMF-PAID-SW PIC X.
....
PROCEDURE DIVISION.
OPEN I-O INPUT-MASTER-FILE.
READ INPUT-MASTER-FILE.
IF IMF-BILLING-TELENO(1:3) = '651'
MOVE '561'TO IMF-BILLING-TELENO(1:3)
END-IF.
REWRITE INPUT-MASTER-RECORD.
what is WRONG in the above segment of code?

a) The rewrite statement needs to rewrite INPUT-MASTER-FILE.


b) The file was not opened EXTEND.
*c) The program attempts to change the record key.
d) The read statement did not specify the KEY phrase.
e) The file was not opened for output.

Q.08)
1)IDENTIFICATION DIVISION.
2)PROGRAM-ID. ABCD3000.
2)DATA DIVISION.

4) WORKING-STORAGE SECTION.
5) 01-E-PLAYER-RECORD-AREA PIC X(120).

6)LINKAGE SECTION.
7) 01 L-PLAYER-TEAM PIC X(03).
8) 01 L-PLAYER-NAME PIC X(30).

PROCEDURE DIVISION USING L-PLAYER-NAME,L-PLAYER-TEAM.

Which two lines in the sample code above need to be changed so that it is in
agreement
with the calling program information below?

W-PLAYER-TEAM PIC X(5).


W-PLAYER-NAME PIC X(30).

Call 'ABCD3000' USING W-PLAYER-TEAM, W-PLAYER-NAME.

a) Lines 7 and 8
b) Lines 8 and 9
*c) Lines 7 and 9
d) Lines 6 and 7
e) Lines 2 and 8

Q.09)
WORKING-STORAGE SECTION.
01 RATE-TABLE.
05 AGE-GROUP OCCURS 6 TIMES INDEXED BY AGE-INDEX.
10 HIGH-AGE PIC 99.
10 CLASS-GROUP OCCURS 4 TIMES INDEXED BY CLASS-INDEX.
15 CLASS-NBR PIC 99.
15 CLASS-RATE PIC S99V99.

01 SEARCH-DATA.
05 SEARCH-AGE PIC 99.
05 SEARCH-CLASS PIC 99.

PROCEDURE DIVISION.
. . .
100-SEARCH-RATE-TABLE.
PERFORM 110-SEARCH-AGE-GROUP.
IF AGE-GROUP-FOUND
PERFORM 120-SEARCH-CLASS-GROUP
IF CLASS-FOUND
MOVE CLASS-RATE(AGE-INDEX CLASS-INDEX) TO WK-HOLD-RATE.
Referring to the code above, which one of the following is correct
coding for the paragraph 120-SEARCH-CLASS-GROUP ?

a)
120-SEARCH-CLASS-GROUP.
SEARCH ALL CLASS-GROUP
WHEN CLASS-NBR(CLASS-INDEX) = SEARCH-CLASS
SET CLASS-FOUND TO TRUE.

b)
120-SEARCH-CLASS-GROUP.
SEARCH CLASS-GROUP
WHEN CLASS-NBR(CLASS-INDEX) = SEARCH-CLASS
SET CLASS-FOUND TO TRUE.

c)
120-SEARCH-CLASS-GROUP.
SET CLASS-INDEX TO 1
SEARCH ALL CLASS-GROUP
WHEN CLASS-NBR(CLASS-INDEX) = SEARCH-CLASS
SET CLASS-FOUND TO TRUE.

*d)
120-SEARCH-CLASS-GROUP.
SET CLASS-INDEX TO 1
SEARCH CLASS-GROUP
WHEN CLASS-NBR(AGE-INDEX CLASS-INDEX) = SEARCH-CLASS
SET CLASS-FOUND TO TRUE.

e)
120-SEARCH-CLASS-GROUP.
SET AGE-INDEX TO 1
SET CLASS-INDEX TO 1
SEARCH CLASS-GROUP
WHEN CLASS-NBR(AGE-INDEX CLASS-INDEX) = SEARCH-CLASS
SET CLASS-FOUND TO TRUE.

Q.10)
OLD-SALARY = salary before annual increase.
NEW-SALARY = salary after annual increase.
GREED-BONUS = Bonus to be calculated.

Management wants every employee that received a salary increase of more than
$10,000
to receive an additional greed bonus that is 50 percent of the salary increase
amount above $10,000. For example, an employee whose new salary increased $20,000
would receive
an additional $5,000 greed bonus.

Which one of the following COMPUTE statement correctly calculates the GREED-BONUS
that is decribed above?
Assume that the new salary is at least $10,000 greater that old.

a) COMPUTE GREED-BONUS = (10000 + NEW-SALARY - OLD-SALARY) * 0.50.


b) COMPUTE GREED-BONUS = (OLD-SALARY - NEW-SALARY - 10000) * 0.50.
c) COMPUTE GREED-BONUS = (NEW-SALARY - OLD-SALARY) * 0.50 + 5000.
*d) COMPUTE GREED-BONUS = (NEW-SALARY - OLD-SALARY - 10000) * 0.50.
e) COMPUTE GREED-BONUS = (NEW-SALARY - OLD-SALARY - 20000) * 0.50.
Q.11)
01 O-REPORT-REC.
05 O-REPORT-HDR PIC X(40).
05 PIC X(02) VALUE SPACES.
05 O-REPORT-DATE.
10 O-REPORT-MM PIC X(02).
10 PIC X(01) VALUE '/'.
10 O-REPORT-YY PIC X(02).
05 PIC X(02) VALUE SPACES.
05 O-REPORT-TIME PIC 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(3:5) TO O-REPORT-TIME

When a page break occurs, a new heading is printed that includes the date and time
as specified below.
Which line or lines of code above prevent this from being produced correctly?

Date: 08/06 or MM/YY


Time 03:10 or HH:MM

a) Line 1
b) Line 2
c) Line 2 and 3
d) Line 3
*e) Line 4

Q.12)
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 contained only three names, there would be only two
commas,
for example, "BARRY, BEWRR, HAL."

05 W-TEXT-FIELD PIC X(500).


05 W-NUM-OF-STUDENTS PIC 9(3).
05 A-COUNT1 PIC 9(3).

Referring to the Working Storage fields in the scenario above,


which one of the following correctly handles these requirements?

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

*b) MOVE 0 TO A-COUNT1


INSPECT W-TEXT-FIELD TALLYING A-COUNT1 FOR ALL ','
IF A-COUNT > 0
ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS.
c) MOVE 0 TO A-COUNT1
INSPECT W-TEXT-FIELD
TALLYING A-COUNT1 FOR ALL ','.

d) MOVE 0 TO A-COUNT1
INSPECT W-TEXT-FIELD TALLYING A-COUNT1 FOR LEADING ','
IF A-COUNT > 0
ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS.

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

Q.13)
CEE3207S THE SYSTEM DETECTED A DATA EXCEPTION (SYSTEM COMPLETION CODE = 0C7)
AT 001B2D03 (DISPLACEMENT 001208 IN LOAD MODULE FRG0253)

The above message appears in the SYSOUT for your job. Where do you look to
find the line of code in which the error occured?

a) Look for displacement 001208 in the DUMP section in the SYSOUT for the job.
b) Seacrch for '1208'in the load moduke for FRG0253.
*c) Look in the cross referebce from the compile of FRG0253 for displacement
001208.
d) Look for line 1208 in the source file for FRG0253.
e) Search for '1B2D03' in the SYSOUT for the job.

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

FD INPUT-MASTER-FILE
01 INPUT-MASTER-RECORD.
05 IMF-BILLING-TELENO PIC X(10).
05 IMF-PAID-SW PIC X.
....
PROCEDURE DIVISION.
OPEN I-O INPUT-MASTER-FILE.
MOVE '9999999999' TO IMF-BILLING-TELENO.

READ INPUT-MASTER-FILE
INVALID KEY
PERFORM 999-ABEND-ROUTINE
NOT INVALID KEY
MOVE 'Y' TO IMF-PAID-SW
REWRITE INPUT-MASTER-FILE
INVALID KEY
PERFORM 999-ABEND-ROUTINE.

ASSUME:
All working storage fields required have been defined
All perform paragraphs exist

For which one of the following reasons does the code show in the scenario above
fail to compile?
a) The OPEN statement should read:
OPEN I-O IMASTER

*b) The REWRITE statement should be:


REWRITE INPUT-MASTER-RECORD

c)The END-READ statement is missing

d)The READ statement should read :


READ INPUT-MASTER-RECORD

e)The REWRITE statement should read:


REWRITE INPUT-MASTER-FILE FROM INPUT-MASTER-RECORD

Q.15)
You are writing a program and you know of a procedure in another program that is
roughly 100
lines long and is almost exactly what you need in your program.

Assume you are editing your program in ISPF. What is the best method to add the
lines
described in the scenario above?

*a) use the COPY primary command to specify the program and lines that you want
copied into your program.

b) Use the CLONE primary command to specify the program and lines that you want
coped into your program.

c) Use the Windows COPY and PASTE commands to copy the lines that have the scource
you want inserted into your program.

d)Use the INSERT primary command to specity the program and lines that have the
source you want inserted into your program.

e)Print the existing section of code and use the printout to type the corresponding
lines into your program.

Q.16)
01 NPA-ARRAY.
05 NPA OCCURS 10 TIMES PIC 999.

Referring to the sample code above, which one of the following search methods is
the best method
to find a specific NPA entry in NPA-ARRAY?

a) A Binary Search
b) A Partitioned search
c) A serial Search
d) A Serialized partioned search
e) A serialized binary search

Q.17)
001 000-MAIN
002 DISPLAY 'STARTED'
003 PERFORM 100-READ
004 UNTIL READ-EOF
005 END-PERFORM
006 DISPLAY 'ENDED'
007 STOP RUN
008 100-READ

Which lines from the above code require periods?

a) None of the lines


b) lines 1 and 8
c) lines 1,7 and 8
d) lines 1,2,6,7 and 8
*e) lines 1,2,5,6,7 and 8

Q.18)
Field in working storage:
05 S-EOF-CHECK PIC X(01).
88 S-NOT-END-OF-FILE VALUE 'N'.
88 S-END-OF-FILE VALUE 'Y'.
MAINLINE.
SET S-END-OF-FILE TO TRUE
PERFORM A0100-PRINT-DETAIL-AND-FOOTERS
UNTIL S-END-OF-FILE
END-PERFORM.
Using the sample working storage and mainline section of a program,
which one of the following is the coding error that occured in the sample above?

a) A READ statement is missing in the MAINLINE section after PERFORM.


b) MAINLINE must not contain any statements other than the PERFORM statement.
*c) S-EOF-CHECK is not properly initialized prior to the PERFORM statement.
d) The line "SET S-END-OF-FILE TO TRUE" is not a valid statement.
e) In working storage, an 88 level must be defined for value of S-EOF-CHECK other
than 'N' and 'Y'.

Q.19)
You are given a skeketon program that processes one input file and creates one
output file.
You are asked to use the skeleton program as the starting point for a new program
that creates
a formatted report rather than an output file.

What sections of code do you need to add to the existing skeleton program in order
to create
the new report program?

a) Working storage for line and page counts.


Procedure for opening and closing files.
Procedure for printing report headings.

b) Working storage for report layout.


Procedure for opening and closing files.
Procedure for printing report headings.

c) Working storage for line and page counts.


Procedure for printing report headings.

*d) Working storage for report layout.


Working storage for line and page counts.
Procedure for printing report headings.

e) Working storage for report layout.


Working storage for line and page counts.
Working storage for control breaks

Q.20)
MOVE FUNCTION DAY-OF-INTEGER(FUNCTION INTEGER-OF-DATE(DATE-1)) TO DATE-2.

What is the purpose of the above line of code?

a) It is an efficient method of moving an alphanumeric date field (DATA-1)


to a numeric edited date field(DATE-2).

*b) It converts a Gregorian date field(DATE-1) to a Julian date field(DATE-2)

c) It converts a date and time field(DATE-1) that is in Greenwich mean time to a


date and time field(DATE-2) that is in local time.

d) It is a way to populate a date field(DATE-2) with the date that is one day prior

to the date in filed DATE-1

e) It is a quick way to determine leap years. If DATE-2 equals DATE-1,


then the year in DATE-1 is a leap year.

Q.21)
05 S-AO2-CHECK PIC X(01).
88 S-A02-FOUND VALUE 'Y'.
88 S-A02-NOT-FOUND VALUE 'N'.
S02-PROCESS-A02.
IF I-RECORD-TYPE = 'A02'
SET S-A02-FOUND TO TRUE
ADD 1 TO A-A02-RECORD-COUNT
END-IF.
PERFORM S0400-WRITE-RECORD.
S0400-WRITE-RECORD.
IF S-A02-FOUND
MOVE I-RECORD TO O-A02-RECORD
WRITE O-A02-RECORD
END-IF.

Referring to the above code, a problem occurred with A01 records being written to
the A02 report.
Which one of the following statements do you add to S0400 to correct this problem?

a) RESET S-A02-CHECK
*b) SET A02-NOT-FOUND TO TRUE
c) INITIAL S-A02-CHECK
d) SET S-AO2-FOUND TO TRUE
e) MOVE 'N' TO S-A02-FOUND

Q.22)
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 BFILED.

Which one of the following values is displayed by the DISPLAY statement in the
sample code above?

a) +005
b) +21
*c) +105
d)+232
e)+323

Q.23)
DATA DVISION.
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 follwoing values is the result to the DISPLAY statement in the
sample code above?

a) +013
*b) +113
c) +114
d) +1013
e) +1113

Q.24)
Which one of the following does the compiler option XREF produce?

a) A listing of line number that are in ascending sequence in the source program
*b) A sorted cross-reference of data names, procedure names, and program names
c) An unsorted cross-reference of data and procedure names
d) A compiler-generated listing of the number associated with each statement
included in the program as a result of using the COPY directive
e) A data description listing

Q.25)
IF RECORD-FOUND
SEARCH ALL RECORD-TYPE-TABLE
WHEN TBL-TYPE = RECORD-TYPE(RTT-INDEX)
PERFORM 5000-UPDATE-RECORD

With respect to the sample code above, which one of the following is NOT an
acceptable
scope terminator for the SEARCH or SEARCH ALL command?

a) END-SEARCH
b) END-IF
c) ELSE
*d) END-PERFORM
e) PERIOD

Q.26)
* A database call to DB2
EXEC SQL... END-EXEC.
* A data communication call to CICS
EXEC CICS . . . . . END-EXEC
* A database or data communication call to IMS
CALL 'CBLTDLI' . . . . END-CALL

Which one of the following statements is true concerning the use of DB2, CICS and
IMS in a COBOL program?

a) DB2 can be used with CICS but not with IMS


b) IMS requires a pre-compile step, DB2 and CICS do not
c) IMS requires an additional link edit step
*d) DB2 and CICS require an additional pre-compile step; IMS does not
e) They are all compile in the same way

Q.27)
Field in working storage:
05 S-PLAYER-FILE-CHECK PIC X(01).
88 S-PLAYER-FILE-NOT-EOF VALUE 'N'.
88 S-PLAYER-FILE-EOF VALUE 'Y'.
05 S-TEAM-FILE-CHECK PIC X(01).
88 S-TEAM-FILE-NOT-EOF VALUE 'N'.
88 S-TEAM-FILE-EOF VALUE 'Y'.
05 S-TEAM-TOTALS-CHECK PIC X(01).
88 S-TEAM-TOTALS-NOT-DONE VALUE 'N'.
88 S-TEAM-TOTALS-DONE VALUE 'Y'.

1) MAINLINE.
2) SET S-PLAYER-FILE-NOT-EOF TO TRUE
3) SET S-TEAM-FILE-NOT-EOF TO TRUE
4) SET S-TEAM-TOTALS-NOT-DONE TO TRUE
5) PERFORM S0100-PROCESS-PLAYER-FILE
UNTIL S-PLAYER-FILE-EOF
END-PERFORM
6) PERFORM S0200-PROCESS-TEAM-FILE
UNTIL S-TEAM-FILE-EOF
END-PERFORM
7) PERFORM S0400-PRINT-TEAM-TOTALS
UNTIL S-TEAM-FILE-EOF
END-PERFORM
.

The numbers for the perform statement are for all three lines of the statement.
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?
a) Line 2
b) Line 4
c) Line 5
d) Line 6
*e) Line 7

Q.28)
Age Class Class Class Class
Range 10 20 30 40
------- ------- ------ ------ ------
01-34 23.50 27.05 35.25 52.90
35-49 25.30 28.75 37.10 54.70
50-99 28.00 32.55 39.75 57.40
Which one of the following is the proper COBOL description of the above table?
a)
01 RATE-TABLE.
05 AGE-GROUP OCCURS 12 TIMES.
10 HIGH-AGE PIC 99.
10 INSURANCE-RATE PIC S99V99.
b)
01 RATE-TABLE.
05 AGE-GROUP OCCURS 3 TIMES.
10 CLASS-GROUP OCCURS 4 TIMES.
15 HIGH-AGE PIC 99.
15 INSURANCE-RATE PIC S99V99.

*c)
01 RATE-TABLE.
05 AGE-GROUP OCCURS 3 TIMES.
10 HIGH-AGE PIC 99.
10 CLASS-GROUP OCCURS 4 TIMES.
15 INSURANCE-RATE PIC S99V99.

d)
01 RATE-TABLE.
05 AGE-GROUP OCCURS 3 TIMES.
10 HIGH-AGE PIC 99.
05 CLASS-GROUP OCCURS 4 TIMES.
10 INSURANCE-RATE PIC S99V99.

e)
01 RATE-TABLE.
05 AGE-GROUP OCCURS 4 TIMES.
10 HIGH-AGE PIC 99.
10 CLASS-GROUP OCCURS 3 TIMES.
15 INSURANCE-RATE PIC S99V99.

Q.29)
ITEM PRICE LOCATION
D00025A 23.50 DTW
D00025B 29.50 DTW
D00025C 33.99 PHL
D00026A 11.20 DTW

Above table is defined as:


01 PRICE-TABLE.
05 PRICE-GROUP OCCURS 50 TIMES.
10 ITEM-CODE PIC X(07).
10 ITEM-PRICE PIC 99V99.
10 ITEM-LOC PIC X(03).

Referring to the table definition above, which one of the following


moves the value of PHL for item D00025C to SAVED-LOC

a) MOVE ITEM-LOC TO SAVED-LOC


*b) MOVE ITEM-LOC(3) TO SAVED-LOC
c) MOVE ITEM-CODE(3) TO SAVED-LOC
d) MOVE ITEM-LOC(D00025C) TO SAVED-LOC
e) MOVE ITEM-LOC(3) OF PRICE-TABLE TO SAVED-LOC
Q.30)
01 DATE-1 PIC X(08) VALUE '20060817'.
01 DATE-2 PIC X(08) VALUE '20070215'.
01 ELAPSED-DAYS PIC S9(3) VALUE 0.

Using the WORKING-STORAGE fields shown, which one of the following


COMPUTE statements properly calculates the number of days from 08.17.2006 to
02.15.2007 ?

a) COMPUTE ELAPSED-DAYS = FUNCTION INTEGER-OF-DATE(DATE-2,'-',DATE-1)


*b) COMPUTE ELAPSED-DAYS = FUNCTION INTEGER-OF-DATE(DATE-2) - FUNCTION INTEGER-OF-
DATE(DATE1)
c) COMPUTE ELAPSED-DAYS = FUNCTION INETGER-OF-DAY(DATE-2,'-',DATE-1)
d) COMPUTE ELAPSED-DAYS = FUNCTION DAYS-DIFFERENCE(DATE-2,DATE-1)
e) COMPUTE ELAPSED-DAYS = FUNCITON INTEGER-OF-DAY(DATE-2) - FUNCTION INTEGER-OF-
DAY(DATE-1)

Q.31)
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
DISPLAY 'FIELDB = ' FIELDB ' FIELDC=' FIELDC ' FIELDD=' FIELDD
STOP RUN.

After execution of the code above, which one of the following represents
the final values of FIELDB, FIELDC and FIELDD?

a) FIELDB=$,$12,345.00 FIELDC=b,+12,345.00 FIELDD=$12,345.00


*b) FIELDB=bb$12,345.00 FIELDC=bb+12,345.00 FIELDD=$b12,345.00
c) FIELDB=b$$12,345.00 FIELDC=bb+12,345.00 FIELDD=$12,345.00
d) FIELDB=b$b12,345.00 FIELDC=b+b12,345.00 FIELDD=$b12,345.00
e) FIELDB=b$b12,345.00 FIELDC=b+b12,345.00 FIELDD=$b12,345.00

Q.32)
100 INITIAL-READ.
110 READ MASTER-FILE
120 AT END MOVE 'Y' TO MASTER-EOF-SW.
130 PERFORM PROCESS-FILE
140 UNTIL END-OF-TRANSACTIONS.
150 GOBACK.
160 PROCESS-FILE.
170 READ TRANSACTION-FILE
180 AT END MOVE 'Y' TO TRANSACTION-EOF-SW
190 NOT AT END PERFORM PROCESS-A-RECORD.
200 PROCESS-A-RECORD.
210 IF TRANSACTION-KEY < PREVIOUS-KEY
220 DISPLAY '??????'
230 ELSE
240 MOVE TRANSACTION-KEY TO PREVIOUS-KEY
250 PERFORM UNTIL MASTER-KEY >= TRANSACTION-KEY
260 READ MASTER-FILE
270 AT END MOVE 'Y' TO MASTER-EOF-SW
280 END-READ
290 END-PERFORM
300 IF MASTER-KEY = TRANSACTION-KEY
310 MOVE TRANSACTION-RECORD TO MASTER-RECORD
320 REWRITE MASTER-RECORD
330 ELSE
340 DISPLAY '??????'
350 END-IF
360 END-IF.

The scenario above presents a simple master-transaction update program segment.


Assume both files are sorted in ascending order of respective key fields.
Referring to statement 340, which one of the following error is detected?

*a) There is no corresponding master record for the transaction being processed
b) There is no corresponding transaction record for the master being processed
c) The master file if out of sequence
d) The transaction file is out of sequence
e) A logic error has occured

Q.33)
01 FIELD1 PIC S9(3) USAGE COMP-3 VALUE ZERO.
01 FIELD2 PIC ------9.
01 FIELD3 PIC 9(8) USAGE COMP VALUE 1.
01 FIELD4 PIC 9(6) USAGE INDEX.
01 FIELD5 PIC $$$,$$$,$$9.

Referring to the code above, which one of the following is NOT a valid MOVE
statement?
a) MOVE FIELD3 TO FIELD5
b) MOVE +33 TO FIELD2
*c) MOVE 999999 TO FIELD4
d) MOVE FIELD1 TO FIELD2
e) MOVE 53.5 TO FIELD1

Q.34)
WORKING-STORAGE SECTION.
01 FIELDA PIC 9(2) COMP-3 VALUE 15.
01 FIELDB PIC 9(2) COMP-3 VALUE 10.
PROCEDURE DIVISION,
PERFORM 3 TIMES
DIVIDE FIELDA BY FIELDB
GIVING FIELDB
REMAINDER FIELDA
ON SIZE ERROR
MOVE 1 TO FIELDA FIELDB
END-DIVIDE
END-PERFORM.
Upon execuction of the sample code above, FIELDA and FIELDB contains what values?

a) FIELDA=1 FIELDB=1
*b) FIELDA=0 FIELDB=0
c) FIELDA=0 FIELDB=5
d) FIELDA=5 FIELDB=1
e) Data exception error occurs.

B A
10 15
1 5
5 0
0 0

Q.35)
010 . . .
020 PROCESS-FILE.
025 IF MASTER-KEY < TRANSACTION-KEY
030 PERFORM UNTIL MASTER-KEY >= TRANSACTION-KEY
035 WRITE MASTER-RECORD
040 READ MASTER-FILE AT END MOVE 'Y' TO MASTER-EOF-SW
050 END-PERFORM.
060 IF NOT MASTER-EOF
070 EVALUATE TRUE
080 WHEN TRANSACTION-IS-UPDATE
090 PERFORM UPDATE-MASTER
100 ...
110
120 UPDATE-MASTER.
130 IF MASTER-KEY <> TRANSACTION-KEY
140 DISPLAY '??????'
160 ELSE
165 MOVE TRANSACTION-RECORD TO MASTER-RECORD
170 WRITE MASTER-RECORD
180 READ MASTER-FILE AT END MOVE 'Y' TO MASTER-EOF-SW.
190 PERFORM GET-NEXT-TRANSACTION.
200 GET-NEXT-TRANSACTION.
. . . .
The scenario above is a master-transaction program segment.
Assume the sequential files are sorted in ascending order by key.
Transactions may add/update/delete master file records.
Refering to statement 140, what error is detetcted?

*a) An attempt to update an existing master has been requested, but the master
record does not exist
b) The transaction file is out of sequence
c) The master file is out of sequence
d) An attempt to add a new master has been requested, but the master record already
exists
e) The master record to be deleted does not exist

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

Avfter execution of the statement in the sample code above,


which one of the following values does the WORK-TABLE contain?

a) AB*CDEF*bb0*
*b) bb*bbbb*000*
c) bbbbbbbb000b
d) bb*bbbb*bb0*
e) ABbCDEFb000b

Q.37)
WORKING-STORAGE SECTION.
01 DATA-TABLE.
05 DATA-FIELD OCCURS 10 TIMES PIC S9(3) COMP-3.
PROCEDURE DIVISION.
MOVE ZEROS TO DATA-TABLE
ADD 1 TO DATA-FIELD(1)

When executed, the sample code above results in which one


of the following exception codes?

a) Boundary violation exceptiom


b) Decimal divide exception
c) Protection exception
d) Operation exception
*e) Data exception

Q.38)
01 FULL-NAME PIC X(20) VALUE SPACES.
01 NAME1 PIC X(10) VALUE 'JOHN'.
01 NAME2 PIC X(10) VALUE 'JOHNSON'.
01 POINTER-FIELD PIC 9(03) VALUE 1.

STRING NAME1 DELIMITED BY SPACE


' ' DELIMITED BY SIZE
NAME2 DELIMITED BY SPACE
INTO FULLNAME
WITH POINTER POINTER-FIELD.

Following the execution of the STRING statement in the code above,


which of the following is the value of the POINTER-FIELD?

a) 01
b) 10
c) 12
*d) 13
e) 20

Q.39)
05 S-ERROR-CHECK PIC X.
88 S-ERROR-OCCURRED VALUE 'Y'.
88 S-NO-ERROR-OCCURRED VALUE 'N'.
01 S-LINE-COUNT PIC S9(3) COMP-3.

01 S0500-ERROR-VERIFICATION.
02 IF S-NO-ERROR-OCCURRED
03 PERFORM S0900-WRITE-ERROR-REC
04 SET S-NO-ERROR-OCCURRED TO TRUE
05 MOVE ZERO TO S-LINE-COUNT
06 ELSE
07 PERFORM S1000-WRITE-REPORT-LINE
08 ADD 1 TO S-LINE-COUNT
09 END-IF

Code in the error verification section must write a record to the error report
and must reset the error switch if any error occurs in the program.
Which one of the following lines in the code above do you correct in order to meet
this requirement?

*a) Line 02
zb) Line 03
c) Line 04
d) Line 05
e) Line 08

Q.40)
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) VALUE 'ABCDEFGHIJ'.
05 PTR USAGE IS POINTER.
05 ARRAY OCCURS 3 TIMES PIC X(10) VALUE SPACES.
05 AREA-INDEX USAGE IS INDEX.
. . .
MOVE CORRESPONDING FROM-AREA TO TO-AREA

Which one of the following statements is a result of the MOVE CORRESPONDING


statement in the above code?
a) All fields are moved
b) None of the fields are moved
c) FIELDA and AREA-INDEX are the onloy fields moved
*d) FIELDA is the only field moved
e) AREA-INDEX and PTR and the only fields moved

Q.41)
MOVE 1 TO DAY-I
PERFORM 5 TIMES
COMPUTE TOTAL-HRS = TOTAL-HRS + DAY-HRS(DAY-I)
ADD 1 TO DAY-I
END-PERFORM

Which one the following PERFORM is equivalent to the above PERFORM?

a)
MOVE 0 TO DAY-I
PERFORM WITH TEST AFTER UNTIL DAY-I = 6
ADD 1 TO DAY-I
COMPUTE TOTAL-HRS = TOTAL-HRS + DAY-HRS(DAY-I)
END-PERFORM

*b)
MOVE 1 TO DAY-I
PERFORM WITH TEST AFTER UNTIL DAY-I = 6
COMPUTE TOTAL-HRS = TOTAL-HRS + DAY-HRS(DAY-I)
ADD 1 TO DAY-I
END-PERFORM

c)
MOVE 0 TO DAY-I
PERFORM WITH TEST AFTER UNTIL DAY-I = 5
COMPUTE TOTAL-HRS = TOTAL-HRS + DAY-HRS(DAY-I)
ADD 1 TO DAY-I
END-PERFORM

d)
MOVE 1 TO DAY-I
PERFORM WITH TEST BEFORE UNTIL DAY-I = 5
ADD 1 TO DAY-I
COMPUTE TOTAL-HRS = TOTAL-HRS + DAY-HRS(DAY-I)
END-PERFORM

e)
MOVE 1 TO DAY-I
PERFORM WITH TEST BEFORE UNTIL DAY-I = 5
COMPUTE TOTAL-HRS = TOTAL-HRS + DAY-HRS(DAY-I)
ADD 1 TO DAY-I
END-PERFORM

Q.42)
05 TEXT-FIELD PIC X(10) VALUE ' NONE'.

MOVE 0 TO NUMBER-OF-SPACES
INSPECT FUNCTION REVERSE(TEXT-FIELD)
TALLYING NUMBER-OF-SPACES FOR LEADING SPACES

After the above INSPECT Statement is executed,


what is the value in NUMBER-OF-SPACES?

a) 0
b) 2
*c) 4
d) 6
e) 10

Q.43)
01 WS-NUMBERS.
05 WN-BINARY-69 PIC 99 VALUE 69 COMP.

In the code above, which one of the following is the proper hexadecimal
representation for the field WN-BINARY-69?
a) 0609
b) F6F9
c) 69
*d) 45
e) 85

Q.44)
01 20-BYTE-FIELD.
05 BYTE PIC X OCCURS 20 TIMES.

Which one of the following statements properly uses subscripts to


right justify the 20-BYTE-FIELD shown above?
Assume 20-BYTE-FIELD > SPACES

a)
PERFORM UNTIL BYTE(20) NOT = SPACE
PERFORM VARYING PTR FROM 20 BY -1 UNTIL PTR=2
MOVE BYTE(PTR-1) TO BYTE(PTR)
END-PERFORM
MOVE SPACE TO BYTE(1)
END-PERFORM

b)
PERFORM UNTIL BYTE(20) NOT = SPACE
PERFORM VARYING PTR FROM 20 BY -1 UNTIL PTR=2
MOVE BYTE(PTR) TO BYTE(PTR-1)
END-PERFORM
MOVE SPACE TO BYTE(1)
END-PERFORM

c)
PERFORM UNTIL BYTE(20) NOT = SPACE
PERFORM VARYING PTR FROM 20 BY -1 UNTIL PTR=2
MOVE BYTE(PTR + 1) TO BYTE(PTR)
END-PERFORM
MOVE SPACE TO BYTE(1)
END-PERFORM

*d)
PERFORM UNTIL BYTE(20) NOT = SPACE
PERFORM VARYING PTR FROM 20 BY -1 UNTIL PTR=2
MOVE BYTE(PTR - 1) TO BYTE(PTR)
END-PERFORM
MOVE SPACE TO BYTE(1)
END-PERFORM

e)
PERFORM UNTIL BYTE(20) NOT = SPACE
PERFORM VARYING PTR FROM 20 BY -1 UNTIL PTR=2
MOVE BYTE(PTR) TO BYTE(PTR + 1)
END-PERFORM
MOVE SPACE TO BYTE(1)
END-PERFORM

Q.45)
01 NICKNAME PIC X(11).
01 DATA-FIELDS.
05 FLDA PIC X(11) VALUE 'SNOOKIEPPOH'.
05 FLDB PIC X(11) VALUE 'SNOOKIEbbbb'.
05 FLDC PIC X(11) VALUE 'WOOKIEbbbb'.
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' indicates a blank

a) SNOOKIEbbbb
b) WOOKbbbbbbb
c) SNOKIEPOOH
*d) WOOKIEbbbbb
e) WICKIEWOCKb

Q.46)
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?
*a) Data Exception
b) Fixed point overflow exception
c) Specfication Exception
d) Decimal Divide Exception
e) The value of DATA-AREA2 becomes +12346.

Q.47)
MOVE 1 TO DAY-I.
PERFORM CALC-TOTAL 5 TIMES.
STOP RUN.

CALC-TOTAL.
COMPUTE TOTAL-HRS = TOTAL-HRS + DAY-HRS(DAY-I).
ADD 1 TO DAY-I.

Which one of the following is equivalent to the above PERFORM?

* a) --> BASED ON ELIMINATION


COMPUTE TOTAL-HRS = DAY-HRS(1) + DAY-HRS(2) +
DAY-HRS(3) + DAY-HRS(4) + DAY-HRS(5)

b) --> END-PERFORM SCOPE TERMINATOR IS REQUIRED


MOVE 1 TO DAY-I
PERFORM 5 TIMES
COMPUTE TOTAL-HRS = TOTAL-HRS + DAY-HRS(DAY-I).
ADD 1 TO DAY-I.
c) --> END-PERFORM SCOPE TERMINATOR IS REQUIRED
MOVE 0 TO DAY-I
PERFORM 5 TIMES
ADD 1 TO DAY-I.
COMPUTE TOTAL-HRS = TOTAL-HRS + DAY-HRS(DAY-I).
d) --> WILL BE PERFORMED ONLY 4 TIMES
MOVE 1 TO DAY-I
PERFORM WITH TEST AFTER UNTIL DAY-I = 5
COMPUTE TOTAL-HRS = TOTAL-HRS + DAY-HRS(DAY-I)
ADD 1 TO DAY-I
END-PERFORM

e) --> WILL BE PERFORMED ONLY 4 TIMES


MOVE 1 TO DAY-I
PERFORM WITH TEST BEFORE UNTIL DAY-I = 5
ADD 1 TO DAY-I
COMPUTE TOTAL-HRS = TOTAL-HRS + DAY-HRS(DAY-I)
END-PERFORM

Q.48)
FD CUSTMAST
RECORD IS VARYING IN SIZE
FROM x TO y CHARACTERS
DEPENDING IN RECORD-LENGTH.
01 CUSTMAST-REC.
05 CR-CUSTOMER-DATA.
10 CR-CUSTOMER-ID PIC X(10).
10 CR-ORDER-COUNT PIC 9(02).
05 CR-ORDER-DATA OCCURS 1 TO 20 TIMES INDEXED BY CROD-INDEX.
10 CR-ORDER-DATE PIC X(08).
10 CR-ORDER-ITEM PIC X(10).
10 CR-ORDER-QTY PIC 9(05).
. . .
WORKING-STORAGE SECTION.
. . .
05 RECORD-LENGTH PIC 9(03).

Given the above layout for CUSTMAST-REC, what are the correct values for
'x' and 'y' in the scenario above?

*a) x=35, y=472


b) x=12, y=35
c) x=35, y=700
d) x=33, y=422
e) x=12, y=500

Q.49)

Age Class Class Class Class


Range 10 20 30 40
------- ------- ------ ------ ------
01-34 23.50 27.05 35.25 52.90
35-49 25.30 28.75 37.10 54.70
50-99 28.00 32.55 39.75 57.40

The above table is defined as:


01 RATE-TABLE.
05 AGE-GROUP OCCURS 3 TIMES.
10 HIGH-AGE PIC 99.
10 CLASS-GROUP OCCURS 4 TIMES.
15 INSURANCE-RATE PIC S99V99.

Referring to the table definition above, which one of the following


moves the value of 37.10, which is located in Class 30 in the Age Range 35-49
to SAVED-RATE ?

a) MOVE INSURANCE-RATE(3) OF AGE-GROUP(2) TO SAVED-RATE


*b) MOVE INSURANCE-RATE(2,3) TO SAVED-RATE
c) MOVE INSURANCE-RATE(8) TO SAVED-RATE
d) MOVE INSURANCE-RATE (3,2) TO SAVED-RATE
e) MOVE INSURANCE-RATE (7) TO SAVED-RATE

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

Upon execution of the sample code above, the receiving field contains
which of the following values?
a) 123.00
b) 123.45
c) 345.67
*d) 567.00
e) 12345.67

Q.51)
A large text field contains all the first names of 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 2
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 this requirement?

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

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

*c)
MOVE 0 TO A-COUNT1
INSPECT W-TEXT-FIELD
TALLYING A-COUNT1 FOR ALL ','.
IF A-COUNT > 0
ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS

d)
MOVE 0 TO A-COUNT1
INSPECT W-TEXT-FIELD
TALLYING A-COUNT1 FOR LEADING ','.
IF A-COUNT > 0
ADD 1 TO A-COUNT1 GIVING W-NUM-OF-STUDENTS

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

Q.52)
01 WS-LITERALS.
05 WL-ERR-05.
10 FILLER PIC X(3) VALUE 'ERR'.
10 FILLER PIC X(1) VALUE SPACE.
10 FILLER PIC X(2) VALUE '05'.
Which one of the following EBCDIC hexadecimal displays corresponds
to field WL-ERR-05 in the above code?

a) 'C5D9D900F0F5'
b) 'C5D9D9400005'
c) 'E R R 0 5'
*d) 'C5D9D940F0F5'
e) 'A5B9B900D0D5'

Q.53)
DATA DIVISION.
WORKING-STORAGE SECTION.
01 COMPLETE-NAME PIC X(30) VALUE SPACES.
01 LAST-NAME PIC X(15) VALUE SPACES.
01 LNM-POINTER PIC S999 COMP-3 VALUE ZERO.
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
posistion
for the move is required and the length value is optional. In order to make the
MOVE statement
in the scenario above to work, what elase do you need to do?

a) Specify the ADDRESS of the field LAST-NAME


b) Do nothing
*c) Set LNM-POINTER to point to the first character of the last name
d) Define COMPLETE-NAME with an OCCURS clause
e) Set an Index to point to LAST-NAME

Q.54)
What are the two primary outputs from the COBOL compiler?
a) Load module and Object Module
* b) Source Listing and Object module
c) Source Listing and Load Module
d) Linkage listing and load module
e) Source listing and Linkage listing

Q.55)

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
DISPLAY 'IF THIS LINE OF TJ'S CODE IS REACHED,
- 'THEN ALL IS WELL'
. . .
Referring to the above code, what does the DISPLAY will print?
a) IF THIS LINE OF TJ'S CODE IS REACHED, THEN ALL IS WELL
b) IF THIS LINE OF TJ'S CODE IS REACHED,
THEN ALL IS WELL
c) IF THIS LINE OF TJ'
S CODE IS REACHED,
THEN ALL IS WELL
d) IF THIS LINE OF TJ'S CODE IS REACHED, THEN ALL IS WELL
*e) compiler error

Q.56)
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
READ MASTER-DATE --> This indicates file cannot be opened in Output Mode
MOVE SYSDATE-RECORD TO MASTDATE-RECORD
WRITE MASTDATE-RECORD
CLOSE SYSTEM-DATE MASTER-DATE.

What is WRONG in the above code?

* a) WRITE MASTER-DATE needs to be replaced with REWRITE MASTER-DATE


b) The files were closed before reading to EOF
c) SYSDATE is a reserved word
d) SYSTEM-DATE needs to be opened in INPUT, not I-O
e) MASTER-DATE needs to be opened in OUTPUT, not I-O

Q.57)
0100 INITIAL-READ.
0110 READ MASTER-FILE
0120 AT END MOVE 'Y' YO MASTER-EOF-SW
0130 READ TRANSACTION-FILE
0140 AT END MOVE 'Y' TO TRANSACTION-EOF-SW
0150 PERFORM PROCESS-FILE
0160 UNTIL EOF-OF-MASTER OR
0170 END-OF-TRANSACTIONS.
0180 GOBACK.
0190 PROCESS-FILE.
0195 IF NOT END-OF-MASTER
0200 PERFORM UNTIL MASTER-KEY >= TRANSACTION-KEY
0210 WRITE MASTER-RECORD
0220 READ MASTER-FILE AT END MOVE 'Y' TO MASTER-EOF-SW
0230 END-PERFORM
0240 . . .
0250 DELETE-MASTER.
0260 . . .
0270 ADD-MASTER.
0280 . . .
0290 UPDATE-MASTER.
0300 . . .

The scenario above is a master-transaction program segment. Referring to the


statements
0200 throguh 0230, what is achieved by continously reading the master file until
its key
is equal to or greater than the transaction file key?

*a) This code traps the condition in which there are no masters for one or more
transaction record
b) This code resequences the master file
c) This code processes the remaining master records in which the transaction file
ends first
d) This code traps the condition in which there are no transactions for one or more
master records
e) This code processes the remainig transaction records in which the master file
ends first.

Q.58)
0100 INITIAL-READ.
0110 READ MASTER-FILE
0120 AT END MOVE 'Y' YO MASTER-EOF-SW
0130 READ TRANSACTION-FILE
0140 AT END MOVE 'Y' TO TRANSACTION-EOF-SW
0150 PERFORM PROCESS-FILE
0160 UNTIL EOF-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-FILE 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-EOF-SW
0380 PERFORM GET-NEXT-TRANSACTION.
0390 ADD-MASTER.
. . .
0460 UPDATE-MASTER.
. . .
0540 GET-NEXT-TRANSACTION.
. . .

The scenario above is a master-transaction code segment. Assume the files are
sorted
into ascending sequence by key fields. Transactions may add, update or delete
master
file records. Referring to the statement 0350, what error, if any, has been
detected?

a) A logic error
b) The master file is out of sequence
c) There is no corresponding transaction record for the master record being
processed
following the initial read.
d) The transaction file is out of sequence
* e) The master record to be deleted does not exist

Q.59)
The MEDIAN function returns the content of the argument whose value is the middle
value
in the list formed by arranging the arguments in sorted order.
If the number of occurrences referenced by the argument-1 is odd, the returned
value is such that
at least half of the occurrences referenced by argument-1 are greater than or equal
to the returned value
and at least half are less than or equal. If the number of occurrences referenced
by argument-1 is even,
the returned value is arithmetic mean of the values referenced by the middle two
occurences.

Given the above definition of MEDIAN, what is the reult of the following sum?

FUNCTION MEDIAN(30 50 20 10 40 20) + FUNCTION MEDIAN(30 50 10 40 20)

a) 40
b) 45
c) 50
* d) 55
e) 60

Q.60)
01 A0100-PROCESS-RECS.
02 MOVE +1 TO A-PROCESS-COUNT
03 PERFORM A0200-TOTALS
04 UNTIL A-PROCESS-COUNT = 5
05 END-PERFORM
06 .
07 A0200-TOTALS.
08 A-TOTALS = A-TOTALS + W-NEW-AMOUNT
09 ADD +1 TO A-PROCESS-COUNT
10 .

A change to a program requires that you process section A0200 from A0100 five
times.
Which one of the following lines, if any, in the sample code above prevents this
code
from meeting that program requirement?

a) Line 2
b) Line 3
*c) Line 4
d) Line 8
e) Line 9

Q.61)
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 layoy needs to be used for an output file.
Which one of the following COPY statements imbeds the above copy member, and
changes the preofix from I- to O-.
a) COPY PLAYER CHANGE ALL "O-" "O-"
b) COPY PLAYER USING "O-" INSTEAD OF "I-"
*c) COPY PLAYER REPLACING ==I-== BY ==O-==
d) COPY O-PLAYER REPLACING "I-" WITH "O-"
e) COPY PLAYER REMOVING "I-" ADDING "O-"
Q.62)

ITEM PRICE LOCATION


D00025A 23.50 DTW
D00025B 29.50 DTW
D00025C 33.99 PHL
D00026A 11.20 DTW
continues....total of 50 entries maximum.

Which one of the following is the proper COBOL description for the above table?

a)
01 PRICE TABLE.
05 ITEM-CODE PIC X(07) OCCURS 50 TIMES.
10 ITEM-PRICE PIC 99V99.
10 ITEM-LOC PIC X(03).
b)
01 PRICE-TABLE.
05 ITEM-CODE PIC X(07) OCCURS 50 TIMES.
05 ITEM-PRICE PIC 99V99 OCCURS 1 TIMES.
05 ITEM-LOC PIC X(03) OOCURS 1 TIMES.

c)
01 PRICE TABLE.
05 PRICE-GROUP OCCURS 50 TIMES.
05 ITEM-CODE PIC X(07).
05 ITEM-PRICE PIC 99V99.
05 ITEM-LOC PIC X(03).
*d)
01 PRICE TABLE.
05 PRICE-GROUP OCCURS 50 TIMES.
10 ITEM-CODE PIC X(07).
10 ITEM-PRICE PIC 99V99.
10 ITEM-LOC PIC X(03).
e)
01 PRICE-TABLE OCCURS 50 TIMES.
05 ITEM-CODE PIC X(07).
05 ITEM-PRICE PIC 99V99.
05 ITEM-LOC PIC X(03).

Q.63)

SELECT MASTER-FILE ASSIGN TO MASTER.

Which one of the following is the correct way to code the FILE SECTION
for MASTER-FILE, which contains 100 byte fixed length records?
*a)
FD MASTER-FILE
RECORD CONTAINS 100 CHARACTERS.
b)
01 MASTER RECORD CONTAINS 100 BYTES.

c)
FD MASTER-FILE
RECORD CONTAINS 100 BYTES.
d)
01 MASTER-FILE PIC X(100).

e)
FD MASTER-FILE 100 BYTES.

Q.64)
Which one of the following statements about subscripts and indexes is correct?
a) Indexes are easier to use than subscripts
b) Only indexes can be passed to a subroutine
*c) Indexes are required for SEARCH & SEARCH-ALL commands
d) Subscripts are more efficient than indexes
e) Subscripts must be defined with USAGE COMP.

Q.65)

IF S04-MBN = '1234'
PERFORM HANDLE-SPECIAL-CUSTOMER
ELSE
IF S04-MBN = '5678'
PERFORM HANDLE-REGULAR-CUSTOMER
END-IF.

Which one of the following statements is equivalent to the sample code above?

a)
EVALUATE S04-MBN
WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER
WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER
END-EVALUATE
*b)
EVALUATE S04-MBN
WHEN '1234' PERFORM HANDLE-SPECIAL-CUSTOMER
WHEN '5678' PERFORM HANDLE-REGULAR-CUSTOMER
END-EVALUATE
c)
EVALAUTE TRUE ALSO TRUE
WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER
WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER
END-EVALUATE
d)
EVALAUTE TRUE
WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER
WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER
END-EVALUATE

e)
EVALAUTE S04-MBN ALSO S04-MBN
WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER
WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER
END-EVALUATE

Q.66)
Which one of the following statements is true regarding COBOL II program structure?
*a) Procedure names must start in Column 8
b) When adding a new line of code, a line number must be declared in columns 73-80
c) All COBOL code must be written in uppercase
d) All working storage code must begin in column 12
e) When adding a new line of code, a line number must be entered in columns 1-6.

Q.67)
1)IDENTIFICATION DIVISION.
2)PROGRAM-ID. ABCD3000.
3)DATA DIVISION.
4) WORKING-STORAGE SECTION.
5) 01-W-PLAYER-RECORD-AREA PIC X(120).
6)LINKAGE SECTION.
7) 01 L-PLAYER-NAME PIC X(03).
8) 01 L-PLAYER-AVG PIC 9(03).

PROCEDURE DIVISION USING L-PLAYER-NAME,L-PLAYER-AVG.

Given the calling program information below, which lines in the above called
program sample are incorrect?

Working storage:
W-PLAYER-TEAM PIC X(30).
W-PLAYER-AVG PIC V999.

Call 'ABCD2000' USING W-PLAYER-NAME, W-PLAYER-AVG.

a) Lines 1 and 6
b) Lines 2 and 7
*c) Lines 2 and 8
d) Lines 5 and 7
e) Lines 5 and 8

Q.68)
WORKING-STORAGE SECTION.
01 INDX PIC S9(03) COMP.
01 ZIP-TABLE.
05 PIC S9(5) VALUE 0.
05 ZIP-CODE-GROUP.
10 ZIP-CODE OCCURS 10 TIMES PIC S9(5).

PROCEDURE DIVISION.
PERFORM VARYING INDX FROM 1 BY 1 UNTIL INDX > 10
MOVE ZERO TO ZIP-CODE(INDX)
END-PERFORM
MOVE ZIP-TABLE TO ZIP-CODE-GROUP

After teh statement shown in the sample code is executed, which one of the
following will be there in each occurence of ZIP-CODE?

a) Nulls
*b) Zeros
c) Unpredictable results
d) Unsigned Zeros
e) Spaces

Q.69)
WORKING-STORAGE SECTION.
. . .
05 WS-SAVED-ID PIC X(4).
05 WN-BINARY-69 PIC 99 VALUE 69 COMP.
. . .
Dump data
0000000001111111111222222222233333333334
1234567890123456789012345678901234567890
. . .
C1C2C3404142434445E7F3F0F945F0F2F3F44500

Displayed above is a portion of working storage and 40 characters of


hexadecimal dump data. Which one of the following dump positions is a valid
starting point for WS-SAVED-ID ?

*a) 01
b) 08
c) 13
d) 19
e) 31

Q.70)
. . .
MOVE 0 TO NBR-VALID-RECS.
PERFORM 100-LOAD-TABLE THRU 199-EXIT
UNTIL DATA-EOF.
. . .
STOP RUN.
100-LOAD-TABLE.
READ TABLE-FILE
AT END SET DATA-EOF TO TRUE
GO TO 199-EXIT
END-READ.
PERFORM 101-VALIDATE.
101-VALIDATE.
IF TABLE-DATA-VALID
ADD 1 TO NBR-VALID-RECS.
199-EXIT.
EXIT.

There are 10 records in TABLE-FILE and four of those records have a condition
TABLE-DATA-VALID.
What is the value of NBR-VALID-RECS after the above code is executed?
a) 0
b) 4
c) 6
*d) 8
e) 10

Q.71)
Sample data shown, 100 entries maximum. Data is ordered by item.
Limit the table size to actual data.

ITEM PRICE
D00025A 23.50
D00025B 29.50
D00025C 33.99
D00026A 11.20

Which one of the following is the proper COBOL description of the above table?
*a)
01 PRICE-TABLE.
05 PRICE-GROUP OCCURS 1 TO 100 TIMES
DEPENDING ON WS-ITEM-COUNT
ASCENDING KEY IS ITEM-CODE.
10 ITEM-CODE PIC X(07).
10 ITEM-PRICE PIC 99V99.
b)
01 PRICE-TABLE.
05 PRICE-GROUP OCCURS 1 UP TO 100 TIMES
DEPENDING ON WS-ITEM-COUNT
ASCENDING KEY IS ITEM-CODE.
10 ITEM-CODE PIC X(07).
10 ITEM-PRICE PIC 99V99.
c)
01 PRICE-TABLE.
05 PRICE-GROUP OCCURS 1 TO 100 TIMES
DESCENDING KEY IS ITEM-CODE.
10 ITEM-CODE PIC X(07).
10 ITEM-PRICE PIC 99V99.
d)
01 PRICE-TABLE.
05 PRICE-GROUP OCCURS UP TO 100 TIMES
DEPENDING ON WS-ITEM-COUNT
AND KEY IS ITEM-CODE.
10 ITEM-CODE PIC X(07).
10 ITEM-PRICE PIC 99V99.
e)
01 PRICE-TABLE.
05 PRICE-GROUP OCCURS 1 TO 100 TIMES
ASCENDING KEY IS ITEM-CODE.
10 ITEM-CODE PIC X(07).
10 ITEM-PRICE PIC 99V99.

Q.72)
Which one of the following statement is true?
a) CALL WS-PROGNAME, always results in a dynamic call;
CALL 'PROGNAME' results in a dynamic call if the DYNAM compiler option is used
b) CALL WS-PROGNAME results in a static call if the NODYNAM compiler option is
used;
CALL 'PROGNAME' results in a dynamic call if the DYNAM compiler option is used
c) CALL WS-PROGNAME results in a static call if the NODYNAM compiler option is
used;
CALL 'PROGNAME' always results in a static call
* d) CALL WS-PROGNAME, always results in a dynamic call;
CALL 'PROGNAME' always results in a static call if the DYNAM compile option is
not used
e) CALL WS-PROGNAME, results in a dynamic call if the DYNAM compiler option is
used;
CALL 'PROGNAME' always results in a dynamic call

Q.73)
Which of the following code generates a random number to simulate the roll of a a
siz sided die
and places the value in the filed DIE ?
a) COMPUTE DIE = FUNCTION INTEGER(FUNCTION RANDOM(6))
b) COMPUTE DIE = 1 + FUNCTION INTEGER(5 * FUNCTION RANDOM)
c) COMPUTE DIE = FUNCTION INTEGER(6 * FUNCTION RANDOM)
d) COMPUTE DIE = 1 + FUNCTION INTEGER(FUNCTION RANDOM(5))
*e) COMPUTE DIE = FUNCTION INTEGER(6 * FUNCTION RANDOM + 1)

You might also like