COBOL Interview Questions & Answers

COBOL is a compiled English-like computer programming language designed for business use. It is an imperative, procedural and, since 2002, object-oriented language. COBOL is primarily used in business, finance, and administrative systems for companies and governments. Here you will find the most commonly asked COBOL interview questions with answers which are faced by interviewee. Also these questions will get you acquainted with the nature of the questions you may be ask during your interview.

1. What is COBOL?

Answer:- COBOL stands for Common Business Oriented Language which is primarily developed for business, finance and administrative system needs.
It is primarily used in company and government business, finance, and administrative systems. This language also used as a solution to many data processing problems.
It is developed by CODASYL (Conference on Data Systems Languages). It is used as a language in the Mainframe System.


2. What are the features of COBOL?

Answer:- Here are the advantages of using COBOL −

1. Simplicity and standardization : COBOL is an easy-to-learn, standard language that can be compiled and executed on a variety of computers. It supports a wide syntax vocabulary and features an uncluttered coding style.
2. Business Oriented : COBOL was designed for business-oriented applications related to financial domain, defense domain, etc. It can handle huge volumes of data because of its advanced file handling capabilities.
3. Robust : Testing and debugging tools are always accessible on all platforms of the computer. Therefore, it is a robust programming language.
4. Remote debugging : Use the Eclipse debugger to step through both native and managed COBOL code on the remote machine.
5. Structure and scalability : The logical control structures available in COBOL make it easy to read, modify and debug. COBOL is also scalable, reliable and portable across platforms.


3. Describe the Structure of the COBOL program?

Answer:- The COBOL program structure is hierarchical (Top to Bottom structure). COBOL program structure consists of Divisions, Sections, Paragraphs, Sentences, Statements, and Character strings. Here, are various components of the COBOL program:

1. Divisions: A division is a block of code, which usually contains one or more sections. It starts where the division name is encountered. It ends with the beginning of the next division.
2. Sections: Sections are the logical subdivision of program logic. A section is a collection of paragraphs.
3. Paragraphs: Paragraphs are the subdivision of a section or division. It is either a user-defined or a predefined name followed by a period, and consists of zero or more sentences/entries.
4. Sentences : These are a combination of one or more statements. Sentences appear only in the Procedure division. It must end with a period.
5. Statements : The statement is a combination of COBOL verb/keyword and an operand or multiple operands. A statement specifies an action to be taken by the program.
6. Characters : These are the lowest in the hierarchy which cannot be divided.


4. How many divisions are there in COBOL?

Answer:- A division is a block of code, which contains one or more sets of sections or set of sentences or a block of statements. Division begins with division name and ends at the beginning of the subsequent division or when the program ends.

In COBOL, there are 4 Divisions:
1. Identification Division : The Identification division is the beginning of the COBOL program, and this is the mandatory section in every COBOL program. This division is used by the compiler and programmer to identify the program.
2. Enviroment Division : Enviroment Division specifies the computer environment on which the program is compiled and executed. Enviroment Division also defines file organization and access methods used in the program.
3. Data Division: Data division contains information about the variables and data items used in the program. It defines the variable names, their lengths, decimal locations, and the information about the storage formats.
4. Procedure Division: This division is used for including the logic of the program. Procedure division also includes executable statements which are defined in the data division.


5. What is string handling in Cobol?

Answer:- String handling statements in COBOL are used to do multiple functional operations on strings. COBOL provides three types of statements for string handling :

1. Inspect : Inspect verb counts or replaces the characters in a string. String operations are performed on alphanumeric, numeric, or alphabetic values. These operations are performed from left to right.
2. String : The string verb is used to concatenate the partial or full contents of two or more string or literal into one single data item. In the String verb, the 'DELIMITED BY' clause is compulsory.
3. Unstring : Unstring verb is used to split a single string into multiple substrings. Delimited By clause is mandatory.


6. What is file access modes in COBOL?

Answer:- Every file organization has different modes of access.The access mode is used to define the accessing way of the file based on the requirements in the program. In short, we can say, access mode defines how the data is required to read and write from the file.
1. Sequential Access : When the access mode is sequential, the method of record retrieval changes as per the selected file organization.
2. Random Access : In random access mode, you control the sequence in which records are accessed. The desired record is accessed by placing its relative record number in a relative key data item.
3. Dynamic Access : In dynamic access mode, both sequential and random access are supported in the same program. This access mode is used for all types of files.


7. What are standard form of Cobol program?

Answer:- Some of the standard form of Cobol program are:

1. There are 80 characters on each line.
2. Columns(l-6): It indicates the sequence
3. Column 7: This position contains the indicator^,/,-)
4. Columns(8-ll): It denotes the Area A.
5. Columns(12-72): It denotes the Area B.
6. Columns(72-80): Use for Identification.


8. What is EVALUATE statement in COBOL Programs?

Answer:-EVALUATE statement is used for conditional processing which helps in eliminating a series of nested IF statements to test several conditions. The EVALUATE statement is very similar to the CASE construct common in many other programming languages. If none of the EVALUATE satisfies, by default the statements coded under WHEN OTHER will be executed and control transfers to the next executable statement after ending of EVALUATE.


9. What is Advantages and Disadvantages of COBOL?

Answer:-
Here, are important advantages of using COBOL language:
1. COBOL language can handle massive data processing.
2. It can handle huge processing volumes with ease.
3. COBOL is the first generally used high-level programming language.

Here, are important disadvantages of using COBOL language:
1. It has very wordy syntax.
2. The time required to compile a COBOL program might be greater than with a machine oriented programming language.
3. It is not designed to handle scientific applications.


10. What is a SSRANGE and NOSSRANGE in Cobol?

Answer:-
SSRANGE : SSRANGE is a compiler option that handles the array overflow. SSRANGE also needs to be specified in COBOL programing language. These help in finding the subscript out of range.

NOSSRANGE : NOSSRANGE is used for performance-sensitive applications. NOSSRANGE is a default option that doesn’t support any runtime error if the index or subscript runs out of range.





Also check :