Top 50 COBOL Interview Questions (2024)

Here are COBOL interview questions and answers for fresher as well experienced candidates to get their dream job.

COBOL Interview Questions and Answers for Freshers

1) What is COBOL?

COBOL is abbreviated as Common Business Oriented Language and it is one of the oldest programming languages. It primarily used for business, finance and administrative systems for companies.

2) What are the different data types in COBOL?

There are three data types in Cobol:

3) What is the difference between subscript and index?

Subscript refers to the occurrence of an array but index is the displacement from the beginning of the array.

An index can only be modified using PERFORM, SEARCH & SET.

4) What is the difference between performing a SECTION and a PARAGRAPH?

SECTION will have all the paragraphs that are part of the section, to be performed.

PARAGRAPH will have only that paragraph to be performed.

5) What is the difference between CONTINUE & NEXT SENTENCE?

CONTINUE is like a null statement and it continues execution, while NEXT SENTENCE transfers control to the next sentence.

6) What are the different OPEN modes available in Cobol?

Open modes can be used for

7) What is Static and Dynamic linking?

In static linking, called subroutine links into the calling program, while in dynamic linking, the subroutine & the main program will exist as separate modules. Dynamic and Static linking can be achieved by choosing either the DYNAM or NODYNAM link edit option.

COBOL Interview Questions

8) What is the use of EVALUATE statement?

Evaluate is just like a case statement or it can be used like a Nested IFs. The difference between EVALUATE and case is that ‘break’ is not used in Evaluate statement and the control comes out of the EVALUATE once a match is found.

9) 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 the each repeated execution of the PERFORM range. The range is executed at least once in TEST AFTER.

10) What is the point of the REPLACING option of a copy statement?

REPLACING allows for the same copy to be used more than once in the same code by changing the replace value.

COPY REPLACING BY

11) What kind of error is trapped by ON SIZE ERROR option?

ON SIZE ERROR option is raised when there is

12) What is the difference between Structured COBOL Programming and Object Oriented COBOL programming?

Structured programming is logical way of programming where the functionalities are divided into modules and helps write the code logically.

Object Oriented Cobol language is a Natural way of programming in which you identify the objects, and then write functions and procedures around that object.

13) What is the LOCAL-STORAGE SECTION?

Local-Storage is allocated each time the 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 WORKING-STORAGE SECTION

14) What are INPUT PROCEDURE and OUTPUT PROCEDURE?

In the INPUT PROCEDURE, the input file is opened, records are read and edited and then are released to the sorting operation. Finally the file will be closed.

[plain]RELEASE recordname FROM inputrecord[/plain]

In the OUTPUT PROCEDURE, output file is opened, the sorted record is returned to the Output record and then the record will be written. Finally the file will be closed.

[plain]RETURN file RECORD into outputrecord[/plain]

15) What is the use of LINKAGE SECTION?

The linkage section is used to pass data from one program to another program or to pass data from a procedure to a program. It is part of a called program that maps to data items in the calling program’s working storage.

16) What are the access modes of START statement?

Access modes are SEQUENTIAL or DYNAMIC for the start statement.

17) What is an in-line PERFORM?

An IN-LINE PERFORM Statement allows the routine being performed to be nested within the perform statement itself instead of being a seperate paragraph

The PERFORM and END-PERFORM statements are used to block the cobol statements between them. In line PERFORM work as long as there are no internal GO TOs, not even to an exit.

18) Which division and paragraphs are mandatory for a COBOL program?

Identification division and Program ID are mandatory for a COBOL program.

19) What is the difference between Global and External Variables?

Global variables are accessible only to the batch program whereas external variables can be referenced from any batch program residing in the same system library.

20) What is Pic 9v99 Indicates?

Pic 9v99 is a three position Numeric field with an implied or assumed decimal point after the first position.

Here, v means an implied decimal point.

COBOL Interview Questions and Answers for Experienced

21) What guidelines should be followed to write a structured COBOL program?

Following guidelines to be following while writing Cobol program:

RELATED ARTICLES

22) How do we get current date from system with century?

Current date with the century is achieved by using Intrinsic function called FUNCTION CURRENT-DATE.

23) What are all the divisions of a COBOL program?

There are four divisions in a cobol program:

24) What is a SSRANGE and NOSSRANGE?

These are options for a compiler to find the subscript out of range. NOSSRANGE is the default option where there will not be any run time error if index or subscript went out of a range.

25) What is COMP-1? COMP-2?

COMP-1 is a Single precision floating point and uses four bytes. COMP2 is the double precision floating number and uses eight bytes.

26) 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.

27) What is the Purpose of Pointer in the string?

The Purpose of Pointer is to specify the leftmost position within receiving field where the first transferred character will be stored.

28) What is binary search?

First, we have to compare the item to be searched with the item at the center.

If it matches, it is good to go with the value else repeat the process with the left half or the right half depending on where the item lies.

29) What is the difference between a binary search and a sequential search?

In a binary search, the table element key values will be in ascending or descending sequence. The table is ‘halved'(Divided into two) to search for equal to, greater than or less than conditions until the element is found.

In a sequential search, the table is searched from top to bottom, so the elements do not have to be in a specific sequence.

The binary search is much faster for more tables, while sequential Search works well with lesser ones. SEARCH ALL is used for binary search; SEARCH for sequential search.

30) Can a Search can be done on a table with or without Index?

No, the table must be indexed to search on a table.

31) What are the different rules to perform a Search?

The SEARCH can be applied to a table

32) Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?

TEST BEFORE is the default statement and the condition is checked before executing the instructions under Perform.

33) What are the different rules of SORT operation?

SORT can be performed when

34) A table has two indexes defined. Which one will be used by the SEARCH?

The index named first can be used by search.

35) When is a scope terminator mandatory?

Scope terminators are mandatory for in-line PERFORMS and EVALUATE statements. Make scope terminator as explicit for good coding standards.

36) Why is it necessary that file needs to be opened in I-O mode for REWRITE?

Before the REWRITE is performed, the record must be open and read from the file. Therefore, the file must be opened in I-O mode for rewrite functionality.

37) How can we find that module can be called – whether DYNAMICALLY or STATICALLY?

The ONLY way is to look at the output of the linkage editor or the load module.

If the module is being called DYNAMICALLY then it will not exist in the main module, if it is being called STATICALLY then it will be exist in the load module.

38) Which Search verb is equivalent to PERFORM…VARYING?

The serial SEARCH verb is equivalent to Perform.. Varying statement and it is nothing but search without ALL.

39) How many Sections are there in Data Division?

There are six sections in Data Division:

40) What is the difference between comp and comp-3 usage?

Comp is for binary usage, while comp-3 indicates packed decimal.

41) What does Exit do?

If EXIT is used, it won’t be more than only sentence within a paragraph.

42) Give some examples of command terminators?

End IF and End Evaluate are the examples of command terminators.

43) What is the difference between Call and a Link?

A call is an actual COBOL command which provokes an external program and returns. Link is same as Call but it does not belong to a COBOL verb.

44) Which mode is used to operate the sequential file?

An O-I mode (Output/Input mode) is used for starting and initiation of processing files. Processing of files is determined by successful execution of an OPEN statement.

45) How many bytes S(8) comp field occupy and its maximum value?

S(8) can store 4 bytes and the highest value is 99999999.

46) How arrays can be defined in COBOL?

Arrays can be defined as –

05 Array1 PIC X(9) which occurs 10 times

05 Array2 PIC X(9) which occurs 20 times

47) What are literals?

A literal is a data item which consists value by itself. It cannot be referred by a name. They are constant data items. There are two types of literals:

48) What is a report item?

A report item is a field to be printed which has Edit Symbols.

49) Can we redefine the field of X(200) to less than 200?

Yes, we can redefine the values from bigger number to smaller number.

50) What is length is Cobol?

Length is like a special register to have the length of a group or an elementary item.

These interview questions will also help in your viva(orals)

You Might Like: