Cobol Interview Questions

Cobol interview questions

COBOL is a versatile platform for the developers as they find their application in a lot of fields such as finance, administration etc. In case you are an aspirant who is seeking for jobs as a COBOL developer, you need to solve every possible question an interviewer can ask.

Read Best COBOL Interview Questions

Here is a set of both basic and advanced level COBOL questions that may appear in your interview.

Download Cobol interview questions PDF

Cobol interview questions

COBOL programing language is segregated into four major divisions. They are-

  • Identification division - It is the most important division in the COBOL program. It is used for identifying the program.
  • Environment division - This division defines the environment for which the COBOL program is written. It consists of two sections: the configuration section and input-output section.
  • Data identification- It is a place which describes the data items, defines the names that are used in the program and also allocates memories as required by the program. It consists of three sections: the file section, working-storage section, and linkage section.
  • Procedure division
Structured COBOL ProgrammingObject Oriented COBOL Programming
  • In this, functionalities are divided into modules.
  • It is a logical way of programming and helps us to write the code logically.
  • It is less secure as there is no feature of data hiding in Structured COBOL programming.
  • In this, first objects are identified and then the functions and procedures are written.
  • It is a natural way of programming.
  • It is more secure as compared with structured COBOL programming because there is a feature of data hiding.
In 1959, the US Department of Defence formed CODASYL (Conference on Data Systems Language). CODASYL was formed with the motive to develop a computer programing language known as COBOL. It is the acronym for Common Business-Oriented Language, which is used for meeting business, administrative, finance needs. COBOL works on easy English terms and phrases so that business users understand and fulfill their data processing needs through COBOL.
COBOL is a dominant programing language that has aided business users since few decades. Following are the features of COBOL as a means of business language-
  • It can be compiled, executed and brought together on various machines.
  • It can handle large volumes of data and it is a business-oriented applications.
  • It offers several debugging and testing tools for business users as it has several versions that make it easy to debug.
  • It is a structured language.
COBOL supports three data types in it programming structure. They are-
  • Alpha-numeric (X)
  • Alphabetic (A,B,C)
  • Numeric (1,2,3)
There are two types of linking in COBOL: static linking and dynamic linking. In static linking, subroutine links into the calling program and doesn’t exist as a separate module. In dynamic module, subroutine doesn’t link into the main program and exists as a separate module. DYNAM or NODYNAM  link edit options can be used for static and dynamic linking.
ON SIZE ERROR happens in situations when the result of the arithmetic operation is larger than the fixed point field. It also happens when it is divisible by 0. Other situations that result in ON SIZE ERRORS are zero raised to zero, zero raised to some negative number or a negative number raised to a fractional power.
  • INPUT PROCEDURE- It defines the operations where input files are first opened. After opening, records are read, edited and altered. It then goes for sorting operations and finally the files are closed.
    [plain]RELEASE recordname FROM inputrecord [/plain]

  • OUTPUT PROCEDURE- It defines the operations where output file is first opened and it receives the sorted record in output record. Then the file is written and finally closed.

    [plain] RELEASE recordname FROM inputrecord[/plain]

In-line PERFORM is a concept where the control will execute a block of statements from same paragraph instead of a separate paragraph. Till the time there are no GO TOs or an exit, IN-LINE PERFORM will continue to work. The PERFORM AND END—PERFORM statements will bracket all the COBOL statements between them.
There is a format that has to be taken care of while writing a structured COBOL program. One has to work within these guidelines to make a structured COBOL-
  • In order to construct case, one has to use EQUIVALENT statements every time.
  • Scope terminators are used for nesting.
  • IN-LINE PERFORM statements are used for writing ‘do’ constructions. Also, use Test before and Test after in perform statements while writing do-while statements.
In binary search, the table is divided into two halves and the key values in table will be arranged in ascending or descending order. When the table is split into two, it becomes easier to search for equal to, greater than or less than conditions until the element is found in the table. The binary search is preferred for more tables and SEARCH ALL is used for binary searching.

In sequential search, the elements are in random positions because they are searched from top to bottom and not in a specific direction. As such they don’t follow a specific sequence. Sequential search is conducted for lesser number of tables and SEARCH command is used here.

SORT operations are performed when merging of two or more files is done. It is done for arranging the data in ascending or descending order. The following rules have to be taken care of while conducting SORT operation-
  • Input and output files must be closed. Input file is the file which has to be sorted in a particular sequence. Output file is the result that we get after the sorting process. We have to make sure that both these files are closed during SORTING process.
  • SELECT clause should be present in working files. Work files are used for holding records during sorting process.
  • Input and output files must have FD entries.
  • Also, short descriptions should be there in file section of work files.
Data division tells us the name that is given to data in the programs that it manipulates. It has six sections-
  • File section- It defines the fields within the records of each file in the program.
  • Working storage section- It defines the names of the data that the program uses for manipulation of data.
  • Screen section – It is used when the program does inout through forms.
  • Report section- It is used for preparing reports.
  • Linkage section.
  • Local storage section- It is used for calling COBOL program.
We can determine the result of the module by only looking at the output of the linkage editor or the load module. If the module doesn’t exist in the main module, then it is called dynamically. If it is exists in the load module, then it is called statically.
INITIALIZE verb initializes the values in a data item to default value. Numeric edited items are set to zero, alphabetic fields and alphanumeric edited items are set to spaces. FILLERS, OCCURS DEPENDING ON items are left untouched.