COBOL Interview Questions and Answers

06 Feb 2023, 15 Questions

COBOL, an acronym for Common Business Oriented Language is an English-like computer programming language compiled and designed primarily for business use. Read more about COBOL and get a job in this field, by going through the COBOL interview questions below carefully.

The COBOL language is still being used in applications that are deployed on mainframe computers, like large-scale batch and transaction processing jobs. Being imperative, procedural and object-oriented, COBOL is mainly used by businesses, finance organizations, and administrative systems for enterprises as well as governments.

If you feel that there is a lot of content that you cannot read all at once, then, you can download all the COBOL interview questions as a PDF which shall enable you to get over these questions and answers offline as well.

Most Frequently Asked COBOL Interview Questions

Here in this article, we will be listing frequently asked COBOL Interview Questions and Answers with the belief that they will be helpful for you to gain higher marks. Also, to let you know that this article has been written under the guidance of industry professionals and covered all the current competencies.

Q1. What are the different data types in COBOL?

In general, there are five different data types in COBOL, they are:

  • Alphabetic
  • Numeric
  • Alpha-numeric
  • Sign
  • Assumed Decimal Point
0 0
Q2. How to define and access an array in COBOL?

COBOL uses the Occures clause to define and access an array/table. To access an array/table in COBOL we can use the INDEX or SUBSCRIPT and access all the elements within it as well.

0 0
Q3. What is the difference between index and subscript in COBOL?
Subscript Index
Means the number of occurrences of an array This means the number of displacement positions of an array.
Always declared in the working-storage section. It need not be declared inside the working-storage section.
It is initialized by the MOVE statement It is initialized by the SET operator.
It is comparatively slow to access It is faster than Subscript
Value is incremented using the ADD operator. Here, the value is incremented using the MOVE operator
Not necessary to declare INDEXED BY clauses. Necessary to declare INDEXED BY and any other clauses in Index.
0 0
Q4. What is static and dynamic linking in COBOL?
Static Linking Dynamic Linking
Here, all the library modules are basically copied into a final executable image. This refers to the names of external or shared libraries that are placed on the memory.
The OS places a single file on the memory containing the source code and other referencing libraries. This lets programmers use a single copy of the executable file once the program has been loaded, but not the original file, a copy of it.
0 0
Q6. What is the difference between binary search and sequential search in COBOL?
Binary Search Sequential Search
In this, table element key values should be in an ascending or descending order. In this, table element keys are not required to be in any order.
The table is “halved” or divided into two sections to search for the matching result. The table is searched from the top to bottom in a sequence until the matching result is found.
The better option for large tables, i.e. tables having more than 70 elements. The better option for small tables, i.e. tables with less than or equal to 70 elements.
SEARCH ALL syntax is used in Binary Searches SEARCH syntax is used for sequential searches.
0 0
Q7. What are the different rules to perform a search in COBOL?

While applying the SEARCH statement, users must abide by these following rules:

  • This statement can only be applied to a Table only if it has been indexed using the INDEXED BY statement.
  • The index must be initialized using the SET operator.
  • This statement cannot be used for finding multiple matches.
  • The SEARCH statement can be only used for doing a sequential or serial search of the table.
  • If the search process reaches the end of an array, automatically the end statement will be executed.
0 0
Q8. What is ssrange and nossrange in COBOL?

In COBOL, SSRANGE is basically a compiler option which is used to handle the array overflow systematically. In the COBOL programming language, SSRANGE also needs to be specified which helps to find the exact subscript out of range.

Whereas, the NOSSRANGE is used in COBOL for very sensitive performance-based applications. The NOSSRANGE is usually the default option which does not support runtime errors if by any case the index or subscript goes out of range.

0 0
Q9. What is the procedure division in COBOL?

In COBOL, the Procedure division is used for including the logic of the program efficiently. Consisting of multiple executable statements using variables that are defined in the data division, this type of division, paragraph and section names are focused to be user-defined.
In the procedure division, there must be at least one statement. The last statement used for ending the execution is either STOP RUN or EXIT PROGRAM.
Here’s an example to demonstrate the procedure division:
   01 WS-NAME PIC A(30).
   01 WS-ID PIC 9(5) VALUE '12345'.
   DISPLAY 'Hello There'.
   MOVE 'Ankit Satpathy' TO WS-NAME.
   DISPLAY "Here is my name : "WS-NAME.
   DISPLAY "Here's my ID : "WS-ID.

0 0
Q10. What is the difference between external and global variables in COBOL?
Global Variable External Variable
It is a type of variable which is available throughout the program. Also available throughout the program, it is declared but not allocated any memory space.
It is applicable only when sharing data among nested programs via the ANSI85 dialect. It is used to access globally declared data, including data declared using EXTERNAL or by other COBOL programs.
This specifies that a data-name is available for every program being contained within the program that declares it. Here, any external data item can be referenced via any program inside the run unit describing the data item.
0 0
Q11. What is the difference between performing a SECTION and a PARAGRAPH?

Here’s the difference in performing a Section and a Paragraph in COBOL

It is just a block of code containing one or more sentences. This is a block of code that contains one or more paragraphs.
It begins with a paragraph name and ends with the starting of the next paragraph. It begins with a section name and ends with the starting of another section.
This can be ended in another way by another section starting or by the end of the program. It cannot be ended another way.
All the paragraphs should code in AREA A. All Sections should also code in AREA A.
Syntax: Paragraph-name. Syntax: {Section-name} SECTION.
0 0
Q12. What is a scope terminator?

A scope terminator is basically any COBOL verb that is always conditional, like, (IF and EVALUATE) or it has a conditional clause such as (COMPUTE, PERFORM, READ) matching scope terminator always. Completed by including the reserved word being terminated, it always starts with END-.

0 0
Q13. What is the difference between continue and next sentence in COBOL?
This statement passes the control after the next implicit scope terminator; i.e. period (.) This passes the control after the next Explicit scope terminator. For example, END-IF, END-PERFORM, etc.
It gives control to the verb which follows the next period. This gives control to the next verb after the scope terminator.
This will focus on the next step after the period no matter the number of controls present. It will focus on scope terminators and other conditions first before going into other controls.
0 0
Q14. How do I resolve the SOC7 error?

First of all, the SOC7 abend error is displayed when there is invalid data inside the comp field and the program is processing some computation on it. To start with, check the data you are passing as input because there must be some corrupt data which is the root cause of this error.
Here are some steps to solve this error:

  • If the method of input is a file and you do have a file-aid and input data layout, use the file-aid to segregate the data on a field level.
  • File-aid will now highlight any of the incorrect data which is Invalid.
  • Now that you have found the data which is invalid, fix the data issue.
0 0
About Best Interview Question
Best Interview Question
Technical Consultant

With our 10+ experience in PHP, MySQL, React, Python & more our technical consulting firm has received the privilege of working with top projects, 100 and still counting. Our team of 25+ is skilled in distinct programming languages such as Python, Java, React.js, Angular, Node.js, PHP, HTML, CSS, Designing, iOS and Android apps, Database, .net, QA, Digital Marketing and Govt. jobs, etc. We are helping 10+ companies in solving their technical problems. When not found coding, our technical consultants can be seen helping out others.