Вы находитесь на странице: 1из 4

COBOL INTERVIEW QUESTIONS

http://www.tutorialspoint.com/cobol/cobol_interview_questions.htm

Copyright tutorialspoint.com

Dear readers, these COBOL Interview Questions have been designed especially to get you
acquainted with the nature of questions you may encounter during your interview for the subject
of COBOL Programming Language. As per my experience, good interviewers hardly plan to ask
any particular question during your interview. Normally questions start with some basic concept of
the subject and later they continue based on further discussion and what you answer:
What do you know about COBOL?
COBOL stands for Common Business Oriented Language. The US Department of Defense, in a
conference, formed CODASYL (Conference on Data Systems Language) to develop a language for
meeting business data processing needs which is now known as COBOL.
List some features of COBOL.
COBOL is a standard language that can be compiled and executed on various machines. It is
ideally suited for business-oriented applications as it can handle huge volumes of data. It provides
numerous bedugging and testing tools. COBOL is a structured language; it has different divisions,
so it is easy to debug.
Name the divisions in a COBOL program.
Identification Division, Environment Division, Data Division, and Procedure Division.
What are the different data types available in COBOL?
Alpha-numeric (X), Alphabetic (A), and Numeric (9).
What is 'IS NUMERIC' clause?
IS NUMERIC clause is used to check if any item is numeric or not. It returns TRUE when the item
against which it is used contains only numbers(0 to 9). The item can be positive or negative.
What are 66 and 88 level used for?
Level 66 is used for RENAMES clause and Level 88 is used for condition names.
What is the difference between subscript and index?
Subscript is the occurrence in an array. Index is the displacement from the beginning of an array.
What is the difference between SEARCH and SEARCH ALL?
SEARCH is a serial search, whereas SEARCH ALL is a binary search. A table must be in sorted order
before using SEARCH ALL.
What is the difference between performing a SECTION and a PARAGRAPH?
Performing a SECTION will cause all the paragraphs that are a part of the section to be performed.
Performing a PARAGRAPH will cause only a paragraph to be performed.
What is a scope terminator?
Scope terminator is used to mark the end of a verb. Example: IF and END-IF.
What are the file opening modes in COBOL?
File opening modes in COBOL include: INPUT, OUTPUT, I-O, and EXTEND.
What is the maximum size of a numeric field we can define in COBOL?
The maximum size of a numeric field is PIC 9(18).
What is the difference between CONTINUE and NEXT SENTENCE?

CONTINUE transfers the control to the next statement after the scope terminator. NEXT SENTENCE
transfers the control to the statement after the first period encountered.
Why we can not define occurs clause at 01 level?
01 is of the record level. We repeat the fields within a record, not the record itself. So an Occurs
clause can not be used at 01 level.
What is the mode in which you will OPEN a file for writing?
To write into a file, the file has to be opened in either OUTPUT or EXTEND mode.
What is the difference between Call By Content and Call By Reference?
The parameters passed in a Call By Content are protected from modification by the called
program. In Call By Reference, parameters can be modified by the called program.
What is a linkage section?
The linkage section is a part of a called program that 'links' or maps to data items in the calling
program's working storage.
What will happen if you code GO BACK instead of STOP RUN in a stand alone COBOL program?
The program will go in an infinite loop.
How is sign stored in a COMP-3 field?
It is stored in the last nibble.
What is the difference between comp and comp-3?
Comp is a binary usage, while comp-3 indicates packed decimal.
What is the purpose of Identification Division?
Identification Division is used for documentation purpose.
What is the difference between static call and dynamic call?
In static call, the called program is a stand alone program, it is an executable program. During run
time we can call it in our called program. As about dynamic call, the called program is not an
executable program; it can be executed through the called program only.
What is Redefines clause?
Redefines clause is used to allow the same storage allocation to be referenced by different data
names.
What is the Purpose of Pointer Phrase in STRING command?
The Purpose of Pointer phrase is to specify the leftmost position within the receiving field where
the first transferred character will be stored.
What is 77 level used for?
It is an elementary level item which cannot be subdivided.
What is binary search?
Compare the item to be searched with the item at the centre. If it matches fine else repeat the
process with the left half or the right half depending on where the item lies.
What is the use of EVALUATE statement?
Evaluate is like a case statement and can be used to replace nested Ifs. No break is required as the
control comes out as a soon as match is found.

Can I redefine an X(10) field with a field of X(20)?


Yes, as Redefines causes both fields to start at the same location.
What is COMP-1 and COMP-2?
COMP-1 is single precision floating point that uses 4 bytes. COMP-2 is double precision floating
point that uses 8 bytes.
What is the function of Accept Verb?
Accept Verb is used to get data such as date, time, and day from operating system or directly from
the user. If a program is accepting data from the user, then it needs to be passed through the JCL.
What is a Compute Statement?
Compute statement is used to write arithmetic expressions in COBOL. This is a replacement for
Add, Subtract, Multiply, and Divide.
How do you define the files referred to in a subroutine program?
Supply the DD cards in JCL just as you would for files referred to in the main program.
What divisions, sections and paragraphs are mandatory in a COBOL program?
Identification Division and Program-Id paragraph are mandatory in a COBOL program.
Where does AREA B in COBOL start from?
Area B starts from 12 to 72 column.
Where does the FILE-CONTROL paragraph appear?
It appears in the Input-Ouput Section in the Environment Division.
What is the difference between Perform With Test After and Perform With Test Before?
If TEST BEFORE is specified, the condition is tested at the beginning of each repeated execution of
the specified PERFORM range. If TEST AFTER is specified, the condition is tested at the end of each
repeated execution of the PERFORM range. The range is executed at least once in TEST AFTER.
What is LOCAL-STORAGE SECTION?
Local-Storage is allocated each time a program is called and will be de-allocated when the
program stops via an EXIT PROGRAM, GOBACK, or STOP RUN. It is defined in the DATA DIVISION
after the WORKING-STORAGE SECTION.
What are the access modes of START statement?
Access modes are SEQUENTIAL or DYNAMIC for the start statement.
What is the difference between PIC 9.99 and PIC9v99?
PIC 9.99 is a four position field that actually contains a decimal point where as PIC 9v99 is three
position numeric field with assumed decimal position.
Can a Search be done on a table with or without Index?
No, the table must be indexed to search on a table.
Why is it necessary to open a file in I-O mode for REWRITE?
Before REWRITE is performed, the record must be opened and read from the file. Therefore, the
file must be opened in I-O mode for rewrite functionality.
What are literals?
A literal is a data item that consists value by itself. It cannot be referred by a name. They are
constant data items.

What will happen if you code GO BACK instead of STOP RUN in a stand alone COBOL program?
A Stop run ends the unit of work and returns control to the operating system whereas GOBACK
returns control to calling program. So if we code GO BACK instead of Stop Run, it will go in infinite
loop.
What is the mode in which you will OPEN a file for writing?
To write into a file, the file has to be opened in either OUTPUT or EXTEND mode.
Where does the FILE-CONTROL paragraph appear?
FILE-CONTROL paragraph appears in the Input-Ouput Section in the Environment Division which
provides information of external data sets used in the program.
What is the length of PIC 9.999?
Length of PIC 9.999 is 5 as '.' takes 1 byte. So total 1 byte for '.' and 4 bytes for 9.
Which cobol verb is used for updating a file?
Rewrite verb is used to update the records. File should be opened in I-O mode for rewrite
operations. It can be used only after a successful Read operation. Rewrite verb overwrites the last
record read.
If 123 value is moved to a PP999 PIC clause, then what is edited value taken?
.00123 edited value will be taken. P is assumed decimal scaling position which is used to specify
the location of an assumed decimal point when the point is not within the number that appears in
the data item. .PIC PP999 means that numeric data item is of 3 characters and there are 5
positions after the decimal point.
Where can we specify OCCURS clause?
In array declaration, we can specify occurs clause on Elementary item as well as on Group item
also.
How many bytes does a S9(7) SIGN TRAILING SEPARATE field occupy?
9(7) will take 7 bytes and 1 byte for SIGN TRAILING SEPARATE, so total 8 bytes it will take.

What is Next?
Further, you can go through the examples which you have practised with the subject and make
sure you are able to speak confidently on them. If you are fresher, then the interviewer does not
expect you to answer very complex questions, rather you have to make your basics very strong.
It really doesn't matter much if you could not answer a few questions, but it matters how you
answered, the ones that you did. So just be confident during your interview. We at tutorialspoint
wish you all the very best.

Вам также может понравиться