You are on page 1of 11

7/5/2021 COBOL/COBOL II QUESTIONNAIRE - Web view COBOL/COBOL II QUESTIONNAIRE. Q.1 COBOL is an acronym.

What - [DOC D…

COBOL/COBOL II Questionnaire

COBOL/COBOL II QUESTIONNAIRE

Q.1 COBOL is an acronym. What does it stand for?


A Common Business-Oriented Language.

Q.2 What are the structured development aids introduced in COBOL II?
A COBOL II offers the following options :
a. EVALUATE : permits CASE construction.
b. The in-line PERFORM : permits 'do’ construction.
c. TEST BEFORE and TEST AFTER in the PERFORM statements : p
while' and 'do until' constructions.

Q.3 What feature in COBOL II is Similar to features in other programming


languages?
A The most obvious are the explicit scope terminators for most processing
actions. An alphabetical list indicates the variety :
end-add end-if end-search
end-call end-multiply end-start
end-compute end-perform end-string
end-delete end-read end-subtract
end-divide end-return end-unstring
end-evaluate end-rewrite end-write

The scope terminator ',' (as well as the period '.') is still available.

Q.4 What are the three categories of data defined in the DATA division?
A The three categories of data defined in DATA division are :
 The file section (FD) information
 Working storage information
 Linkage-section data definitions

Q.5 When is using READ INTO not advisable?


A READ INTO performs two actions : the file is read into the buffer and the
record is moved to working storage. The construct assumes that the LRECL of
every record is the same. When used with variable-length records, the results
may be "unexpected".

Q.6 What are the techniques for achieving "top-down" programming?


A Top-down is an effort to avoid spaghetti code and is sometimes referred to as
"go to less" programming. Processing is performed from beginning to the end
of paragraphs. Performs rather than "go tos" are used to move through code.
The PERFORM... THRU structure should be used only when THRU is to a
paragraph.

Q.7 What is the EVALUATE statement?

https://fdocuments.in/reader/full/cobolcobol-ii-questionnaire-web-view-cobolcobol-ii-questionnaire-q1-cobol 1/11
7/5/2021 COBOL/COBOL II QUESTIONNAIRE - Web view COBOL/COBOL II QUESTIONNAIRE. Q.1 COBOL is an acronym. What - [DOC D…

COBOL/COBOL II Questionnaire

Q.9 What does the INITIALIZE statement do?


A The INITIALIZE statement initializes data areas to zeros and spaces.

Q.10 How can you use INITIALIZE for specifying specific values?
A INITIALIZE GROUP-ITEM REPLACING ALPHANUMERIC DATA By HIGH-VALU
REPLACING option is used, only specific type will be initialized.

Q.11 What is reference modification?


A Reference modification is the name for substring manipulations. The ‘:’
allows part of a data item to be used without defining data item in the data
division.

Q.12 Give two examples of how you would use reference modification?
A 1. In a list of ZIP codes, the first three digits define a geographic area
:
IF ZIP ( I : 3 ) = '100'
AREA = MANHATTAN
END - IF
2. MOVE 'MEXICO' TO STATE ( 5 : 6 ) could change NEW JERS
MEXICO.

Q.13 What is a nested program?


A A nested program is a program that allows coding of multiple procedure
division within a single program. It is like a CALL, but it is more
efficient.

Q.14 What is the difference between a directly contained and an indirectly


contained program in a nested program?
A A directly contained program is in the next-lower nesting, while the
indirectly contained program is more than one nesting below.

Q.15 Can there be a problem using ROUNDED in a compute statement?


A Yes. The compute rounds each intermediate result in a compute statement and
not just the final result.

Q.16 Name some of the advantages of COBOL II?


A VS-COBOL II makes the operation of computer programs more efficient :
 It allows code to be shared.
 It optimizes code.
 It allows faster sorting.
 It eases program bugging and maintenance namely :
 Supports a debugging tool: COBTEST.
 Program listings provide information in a user-oriented way.
 Formatted dumps display status of programs and files in COBOL format,
including data names and content.
S CO O /C CS i i i i k ih b f d fi

https://fdocuments.in/reader/full/cobolcobol-ii-questionnaire-web-view-cobolcobol-ii-questionnaire-q1-cobol 2/11
7/5/2021 COBOL/COBOL II QUESTIONNAIRE - Web view COBOL/COBOL II QUESTIONNAIRE. Q.1 COBOL is an acronym. What - [DOC D…

COBOL/COBOL II Questionnaire

 REMARKS paragraph and NOTES statement


 The ON statement (ON 1 PERFORM ...)

Q.19 What is a nested-copy statement?


A Independent blocks of code can be copied into the main sections of a program
during compilation. COBOL II allows copied code to copy other code.

Q.20 What is an example of application efficiency provided by COBOL II?


A COBOL II will allow a program to be compiled as RE-ENTRANT. A re-e
program can be placed in a shared virtual storage area, so that one copy of
program is used to satisfy all concurrent requests for the program.

Q.21 What is COBTEST?


A COBTEST is a debugging tool for examining, monitoring and controlling VS
COBOL II programs in a test environment. Programs can be debugged by using a
full-screen interactive mode, as well as a line interactive or batch mode.
DATA may be altered, logic may be changed and results can be viewed on-line.

Q.22 How has the return code for VSAM files been changed in COBOL II?
A The return code has been enlarged to 6 bytes and returns the VSAM return code
when the FILE STATUS is not 00. The format of the expanded return code is as
follows :
 REGISTER 15 Return Code PIC 9(2) COMP.
 FUNCTION CODE PIC 9(1) COMP.
 FEEDBACK CODE PIC 9(3) COMP.

Q.23 What type of documentation would you recommend for a COBOL program?
A Document code changes at the beginning of the Program. The documentation
should include chronological references following the date compiled statement
and should include date in a fixed position and a brief description of the
change in a fixed position.

Programming techniques such as the use of copybooks, meaningful var


name, use of 88 levels and top-down code also provide informative
documentation.

Q.24 What is the file organization clause?


A The file organization clause identifies logical structure of a file.

Q.25 Can the logical structure of a file be changed once it has been created?
A No.

Q.26 What is file organization indexed?


A The file organization indexed is where the position of each logical record
within a file is determined by indexes created with the file and embedded in
k i h d

COBOL/COBOL II Questionnaire
https://fdocuments.in/reader/full/cobolcobol-ii-questionnaire-web-view-cobolcobol-ii-questionnaire-q1-cobol 3/11
7/5/2021 COBOL/COBOL II QUESTIONNAIRE - Web view COBOL/COBOL II QUESTIONNAIRE. Q.1 COBOL is an acronym. What - [DOC D…

Q.29 What is the dynamic access mode?


A The dynamic access mode permits reading and writing file records by a
specific read or write statement which can be sequential and/or random. The
dynamic access mode assumes that a file is indexed.

Q.30 What access modes are permitted with sequential organization?


A The sequential access mode only.

Q.31 What access modes are permitted with indexed organization?


A All three access modes-sequential, random and dynamic-are permitted. In
dynamic access mode, the file can be accessed sequentially and/or randomly.

Q.32 What access modes are permitted with relative organization?


A All three access modes-sequential, random and dynamic-are permitted.

Q.33 What is a START statement?


A The START statement is used with an indexed or relative organization file for
positioning within the file for subsequent sequential record retrieval. The
access key may be qualified to provide a record equal to the key, greater
than the key, less than the key, greater than or equal to the key.

Q.34 Who t is a subscript?


A A subscript is a positive integer that represents an occurrence within a
table that has been redefined with an occurs clause. A subscript must
defined in working storage and can be manipulated like any numeric variable.

Q.35 What is an index for tables?


A An index references data in a table, but does it differently than a
subscript. The index is defined with the table and represents a displacement
into the table.

Q.36 What are the advantages of indexes?


A Indexes are more efficient when used with the SEARCH verb because the
computer does not have to generate displacement from the beginning
table.

Q.37 What are two SEARCH techniques?


A The sequential or serial search moves through a table one record at a time
until a match has been made. For example, in a table of 10 numbers (1 to 10),
to find the number 8, the search must check and eliminate numbers 1 to 7. The
process is initiated by verb SEARCH.

The binary is a dichotomizing search and must have a key that is in ascending
or descending order. At each step of search, half of the records in the table
are eliminated. For example, in SEARCH for the number 8, the first division

COBOL/COBOL II Questionnaire

https://fdocuments.in/reader/full/cobolcobol-ii-questionnaire-web-view-cobolcobol-ii-questionnaire-q1-cobol 4/11
7/5/2021 COBOL/COBOL II QUESTIONNAIRE - Web view COBOL/COBOL II QUESTIONNAIRE. Q.1 COBOL is an acronym. What - [DOC D…

Q.40 What is the most efficient method for locating data in a table?
A If you know the location of the data in the table, use it. For example, in a
table of names of months, use numeric value of the month to locate the name.
To convert 04/01/93 to April 01 1993, the 04 would be used as the subscript
to locate the word April.

Q.41 How could one subscript sequentially through a table of 50 states, looking
for NY?
A Given the subscript SUB-1 PIC 99, the following COBOL II code could be used :

PERFORM TABLE - LOOK - UP THRU TABLE - EXIT VARYING SUB 1 FOR


BY 1 UNTIL SUB - 1 > 50 OR MATCH - FOUND.

CONTINUE 1. (CONTINUE WITH PROGRAM)

TABLE - LOOK - UP.

IF STATE (SUB - 1) = ‘NY’


SET MATCH - FOUND TO TRUE
MOVE TABLE-DATA (SUB-1) TO OUTPUT DATA
END-IF

TABLE - EXIT. EXIT.

Q.42 Recode the foregoing table lookup using an in-line perform.

PERFORM VARYING SUB - 1 FROM 1 BY 1 UNTIL MATCH - FOUND OR SU


IF STATE (SUB - 1) = ‘NY’
SET MATCH - FOUND TO TRUE
MOVE TABLE - DATA (SUB - 1) TO OUTPUT - DATA
END - IF.
END - PERFORM.

Q.43 Give answer to the previous question using a binary search, given the 0
level table name as 01 TABLE-NAME, the occurs clause indexed by table-index,
ascending key is table-item.

SEARCH ALL TABLE - NAME


AT END
MOVE ‘FILE-ITEM NOT FOUND’ TO FILE - ITEM - DESC
WHEN TABLE - ITEM (TABLE - INDEX) EQUALS FILE - ITEM
MOVE TABLE - ITEM - A (TABLE - ITEM) TO FILE - ITEM
END - SEARCH.

Q.44 Describe a paragraph - naming convention that would assist navigation through

https://fdocuments.in/reader/full/cobolcobol-ii-questionnaire-web-view-cobolcobol-ii-questionnaire-q1-cobol 5/11
7/5/2021 COBOL/COBOL II QUESTIONNAIRE - Web view COBOL/COBOL II QUESTIONNAIRE. Q.1 COBOL is an acronym. What - [DOC D…

COBOL/COBOL II Questionnaire

Q.46 What is the format of a COBOL internal sort using an input procedure and an
output procedure?
A. SELECT SORT-FILE
SD SORT - FILE
SORT RECORD IS SORT - WORk - RFC.

01 SORT - WORK REC.


05 SORT-DATA.
07 DATA - PART - 1 PIC X(10).
07 FIRST - SORT - KEY PIC X(5).

(continue with record description for fields necessary fo


sorting and fields to be sent to sort, the entire re
need to be sorted unless required by the program)

PROCEDURE DIVISION.
SORT SORT - FILE
ASCENDING KEY FIRST - SORT - KEY
INPUT PROCEDURE SORT - INPUT - PROCEDURE
OUTPUT PROCEDURE SORT - OUTPUT - PROCED

SORT - INPUT - PROCEDURE - 0200 SECTION.


SORT - INPUT - READ - SELECT.

fuse the input procedure to read the fi


sorted, select all or portion of data, pr
data in any way and move the data to the sort -
- rec for subsequent release to the sort.)

RELEASE SORT - WORK - REC.

SORT - OUTPUT - PROCEDURE - 0500 SECTION.


SORT - OUTPUT - PROCESSING.
https://fdocuments.in/reader/full/cobolcobol-ii-questionnaire-web-view-cobolcobol-ii-questionnaire-q1-cobol 6/11
7/5/2021 COBOL/COBOL II QUESTIONNAIRE - Web view COBOL/COBOL II QUESTIONNAIRE. Q.1 COBOL is an acronym. What - [DOC D…

(use the output procedure to return and process the so


records)

RETURN SORT - FILE AT END ...

Q.47 What are come advantages of a COBOL internal sort?


A. The advantages of a COBOL internal sort are :
 You can select only the records required by the program, reducing sort
resource requirements
 Records can be processed before and after the sort
O b f d h d f diff

COBOL/COBOL II Questionnaire

lowest key to the first item’s position. The process is continued, starting
with the second item, comparing it to the third item, swapping pairs of items
until the entire table is in order.

Q.50 What is an in-line perform?


A COBOL II allows a performed procedure to be, coded in-line. The perform
statements is coded without a paragraph name, followed directly by the code
to be performed. An END - PERFORM statement is required and coded at the end
of an in-line perform.
PERFORM
:
END - PERFORM

Q.51 What Is COBOL II statement WITH TEST AFTER?


A In a PERFORM, the UNTIL clause is examined before the PERFORM, not
COBOL II allows programmer to specify PERFORM WITH TEST AF
always execute a paragraph at least once.

Q.52 How could 88 levels be used for validation of data for valid values and valid
ranges?
A. The 88 level is used to specify the valid values and/or rings of values and
then the 88 data name is used in an if statement to test the data.

Q.53 Give an example of how you would code an “88”.


A 02 INPUT - LOCATION PICTURE 9(3).
88 VALID - LOCATIONS VALUES ARE 100, 200 THRU 299.

Q.54 How could 88 levels be used to determine the next step in navigating through
a program?
A The 88-level data name can be used to specify a condition in both if and
evaluate statements.
IF VALID - LOCATIONs
PERFORM PARA - A
END - IF

EVALUATE TRUE
https://fdocuments.in/reader/full/cobolcobol-ii-questionnaire-web-view-cobolcobol-ii-questionnaire-q1-cobol 7/11
7/5/2021 COBOL/COBOL II QUESTIONNAIRE - Web view COBOL/COBOL II QUESTIONNAIRE. Q.1 COBOL is an acronym. What - [DOC D…
WHEN VALID -LOCATIONS
PERFORM PARA - A
WHEN OTHER
PERFORM PARA - B
END-EVALUATE

Q.55 What is a CALL statement in COBOL?


A A CALL is a statement that transfers control from one object program to
another object program within the same run-unit..

COBOL/COBOL II Questionnaire

Q.59 What is the USING phrase of CALL statement?


A The USING phrase makes available data items from calling to the called
programs.

Q.60 When can the USING phrase be included in the CALL statement?
A The USING phrase can be included in the CALL statement only if there is a
USING phrase in the Procedure Division header or the ENTER statement through
which the called program is invoked.

Q.61 Can the number of operands in the USING phrase in called program be different
than the number of operands in the USING statement of calling programs?
A The number of operands in the calling program USING phrase and the cal
program USING phrase must be identical.

Q.62 How do file operands of the calling program USING phrase align with
operands of the called program USING phrase?
A The correspondence is by position - not by name.

Q.63 Can a called program contain CALL statements?


A: Yes. However, a called program may not CALL the calling program directly or
indirectly.

Q.64 What is a COPY statement?


A The COPY statement copies existing text from a copy library into a COBO
program. For example :
COPY text - name.

Q.65 What is a copy library?


A. A copy library is basically a COBOL source library containing members that
can be, copied into COBOL source programs.

Q.66 What type of text can be copied using the COPY statement?
A. The type of text that can be copied into a COBOL program includes all types
of components of a COBOL program, including file definitions, working storage
and procedure division code.

Q.67 What is the REPLACING option of a COPY statement?


A The REPLACING option of a COPY statement contains two operands and performs
https://fdocuments.in/reader/full/cobolcobol-ii-questionnaire-web-view-cobolcobol-ii-questionnaire-q1-cobol 8/11
7/5/2021 COBOL/COBOL II QUESTIONNAIRE - Web view COBOL/COBOL II QUESTIONNAIRE. Q.1 COBOL is an acronym. What - [DOC D…

the COPY, replacing all occurrences of the first operand within the copied
library member text by the second operand.

Q.68 Can the text of a copy library member contain nested COPY statements?
A In COBOL II a copy library member may contain nested COPY statements. This is

not the case in VS-COBOL.

COBOL/COBOL II Questionnaire

Q.72 What is the BY CONTENT phrase in COBOL II?


A The BY CONTENT phrase permits constants to be passed to a called program by
using the CALL statement.

Q.73 What is the BY CONTENT LENGTH phrase in COBOL II?


A: The BY CONTENT LENGTH phrase permits the length of a data item to be passed
to a called program by using the CALL statement.

Q.74 What is the PICTURE clause?


A The PICTURE clause defines an elementary items basic characteristics and
editing requirements.

Q.75 What would be the result of moving 030193 to a PICTURE clause of


99/99/99?
A The result would be 03/01/93 - but only if the month, day and year were moved
separately.

Q.76 How are numbers stored in the computer?


A: Each digit is stored in a single byte; the first 4 bits contain the “zone”.
The last 4 bits contain the digit. For numbers the zone indicates positive
numbers (a C or an F) and negative numbers (D).

Q.77 What is EBCDIC?


A: EBCDIC is an acronym for Extended Binary Coded Decimal Interchange Code.

Q.78 In EBCDIC, how would the number 1234 be stored?


A The number 1234 would be stored as : Fl F2 F3 F4.

Q.79 What is packed decimal?


A. It is a method of storing numbers in less space. The zone is eliminated from
each of the digits except for the last digit which contains sign for number.
Packed decimals are always stored in an even number of bytes and the last
byte is always the sign. The number of bytes used is determined by adding 1
to the total bytes requested and dividing by 2. The answer is always an even
number.

Q.80 How would the number +1234 be stored if a PIC clause of PICTURE S9(4) COMP-3
were used?
A The answer will use 3 bytes (4 + 1 = 5 / 2 = 2.5 or 3), so a leading 0 will
pad the answer : 01234F.
https://fdocuments.in/reader/full/cobolcobol-ii-questionnaire-web-view-cobolcobol-ii-questionnaire-q1-cobol 9/11
7/5/2021 COBOL/COBOL II QUESTIONNAIRE - Web view COBOL/COBOL II QUESTIONNAIRE. Q.1 COBOL is an acronym. What - [DOC D…

Q.81 What are binary numbers?


A Binary numbers are strings of 0s and 1s which are stored in half word, full
word, or double word, depending on the size of the number.
 Up to 4 digits are stored in 2 bytes or a half word.

COBOL/COBOL II Questionnaire

Q.84 What will be the result of executing a VS-COBOL II program that was compiled
with the SSRANGE option, when a subscript exceeds the table limits?
A The program will terminate.

Q.85 What is a common problem associated with reading a datafile in a test


environment?
A A read is executed on a file that has not been opened by the program.

Q.86 What problem could occur when a file is read with an incorrect file
definition?
A A data exception could occur causing the program to terminate.

Q.87 In a production environment, what should be programmed when an abnor


condition is encountered and it is undesirable to continue processing?
A The program should go to a programmed abnormal exit and pass a condition code
to the job control language via. an installation standard abend procedure.
The job control language should in turn test the condition code and force the
job to terminate with an abnormal condition code

https://fdocuments.in/reader/full/cobolcobol-ii-questionnaire-web-view-cobolcobol-ii-questionnaire-q1-cobol 10/11
7/5/2021 COBOL/COBOL II QUESTIONNAIRE - Web view COBOL/COBOL II QUESTIONNAIRE. Q.1 COBOL is an acronym. What - [DOC D…

https://fdocuments.in/reader/full/cobolcobol-ii-questionnaire-web-view-cobolcobol-ii-questionnaire-q1-cobol 11/11

You might also like