Dec

Cobol Interview Questions
- Anuj Awasthi
- 02nd Dec, 2022
- 950 Followers
Cobol Interview Questions
COBOL is a versatile platform for 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.
Here is a set of both basic and advanced-level COBOL Interview Questions that may appear in your interview.
Quick Questions About Cobol
COBOL is | a Computer programming language. |
COBOL is under | used for Business. |
COBOL is developed By | CODASYL, ANSI, ISO |
COBOL is | Weak, static Typing discipline language |
COBOL is acronym | for common business-oriented language |
COBOL is mainly | Used for large-scale batch and transaction processing jobs |
COBOL Interview Questions
1) What is COBOL?
COBOL is weak and static Typing discipline computer programming language designed for common business use.
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.
2) What are different data types in COBOL?
- Alpha-numeric (X)
- Alphabetic (A,B,C)
- Numeric (1,2,3)
3) Define what is in-line PERFORM in Cobol?
In-line PERFORM is a concept where the control will execute a block of statements from the 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.
4) What is the use of INTIALIZE verb in Cobol?
INITIALIZE verb initializes the values in a data item to the 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.
5) What is a SSRANGE and NOSSRANGE in Cobol?
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 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.
6) Enlist some divisions in a COBOL program?
Identification , Environment , Data , and Procedure are some divisions in a COBOL program.
7) For what 66 and 88 level used in Cobol?
In Cobol Level 66 is used for RENAMES clause and Level 88 is used for condition names.
8) What is LINKAGE SECTION in Cobol?
Linkage section in Cobol is used for passing data from one program to another program or to pass data from a procedure to a program.
9) How many sections are available in Cobol Data Division?
In single Data Division 6 sections are available
- File Section
- Working Storage Section
- Local Storage Section
- Screen Section
- Report Section
- Linkage Section
10) What is length is Cobol?
It is a special register that has the length of an elementary item or a group.
11) Write some characteristics of COBOL as means of business language.
COBOL is a dominant programing language that has aided business users for a 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 application.
- 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.
12) Define static linking and dynamic linking.
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 the 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.
13) What kind of error is trapped by ON SIZE ERROR option?
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.
14) Differentiate between Structured COBOL programming and object-oriented COBOL programming.
Structured COBOL Programming | Object Oriented COBOL Programming |
---|---|
|
|
15) What are INPUT PROCEDURE and OUTPUT PROCEDURE?
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]
16) Mention the guidelines to write a structured COBOL program?
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 a 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 Tests before and Test after in performing statements while writing do-while statements.
17) Write down the divisions of COBOL program?
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
18) What is the difference between binary search and sequential search?
In binary search, the table is divided into two halves and the key values in the 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. A sequential search is conducted for a lesser number of tables and SEARCH command is used here.
19) What are the different rules for performing SORT operation?
SORT operations are performed when the 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 that has to be sorted in a particular sequence. The output file is the result that we get after the sorting process. We have to make sure that both these files are closed during the SORTING process.
- A SELECT clause should be present in working files. Work files are used for holding records during the sorting process.
- Input and output files must have FD entries.
- Also, short descriptions should be there in the file section of work files.
20) Name the sections present in data division.
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 the manipulation of data.
- Screen section – It is used when the program does in-out through forms.
- Report section- It is used for preparing reports.
- Linkage section.
- Local storage section- It is used for calling COBOL program.
21) How to know whether the module is dynamical or statistical?
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 exists in the load module, then it is called statically.
22) When is a scope terminator mandatory?
Scope terminators are mandatory in COBOL in in-line PERFORMS and EVALUATE statements. For ease of reading, it is suggested coding practice to always make scope terminators explicit.
23) For REWRITE, why is it mandatory that file needs to be opened?
In order to conduct REWRITE, it is mandatory to open the record and read it from the file. So, it is important that the file must be opened in I-O mode for conducting rewriting function.
24) What are the different rules to perform a search?
The prerequisite for performing a search function in a table is-
- The table must have OCCURS clause present in it.
- It should be INDEXED BY phrase.
- There should be some initial value present in the search index.
- Always set the index value to 1.
25) What is the difference between NEXT SENTENCE and CONTINUE in COBOL programing language?
In COBOL language, NEXT STATEMENT is used to give control to the next verb following next period. Next Sentence is the collection of sentences that always ends with (.) so the control passes over to next verb following next period. When NEXT SENTENCE is coded, 1 will not be added to input count.
CONTINUE statement is used to give control to the next verb after the explicit scope terminator. When CONTINUE is coded, +1 will be added to input count.
Leave A Comment :
Valid name is required.
Valid name is required.
Valid email id is required.