Online Tutorials & Training Materials | STechies.com
Register Login

Top Cobol Interview Questions and Answers (2020 Updated)

14 May 2019 10:32 am || 0

Q.1) What is Cobol and what does Cobol stand for?

Cobol is a high-level language for programming business applications. It stands for Common Business-Oriented Language. It was the first-ever programming language developed for working with various operating systems. Cobol remains a popular language even today among many business programmers. To make the language easier to understand and interpret, Cobol uses English words.

Q.2) What are some pro and cons of Cobol programming?

Here are some of the advantages of Cobol programming.

  • It is easy to read and understand. The language resembles high-level English, which contains cross-reference tables, footnotes, paragraphs and appendices.
  • It can process huge amounts of data with ease.
  • Cobol is still one of the most preferred languages for many business applications because it excels in making these programs

Cobol programming is problematic for a few reasons. These are

  • Programmers working on Cobol may need to have knowledge about machine language code. Therefore, such a programmer may need to be proficient in two programming languages, instead of just one.
  • The Cobol programming compilation takes longer than compilation through other machine programming languages.

Q.3) What is Micro Focus Cobol?

Microfocus Cobol or MF Cobol is a modernized version of Cobol programming language. This language powers most finance and business applications to this day. MF Cobol is frequently in use across military and governmental programs as well. The popularity of microfocus Cobol is because it is the most readable and understandable programming language.

Q.4) How to convert packed decimal to numeric in Cobol?

If you are trying to convert a packed decimal input into a numeric input, look for the SORT utility or tool in Cobol. Once you find it, you can simply use Edit Mask on the SORT to change a packed decimal into numeric during the programming.

Q.5) How many divisions are present in Cobol?

Cobol has four major divisions. These are

  • Environment Division
  • Identification Division
  • Procedure Division
  • Data Division

Q.6) What is the picture clause in Cobol?

Picture clause in Cobol performs a few functions. In Cobol, picture clause defines the characteristic of elementary items, such as length and data item. However, the picture clause works with elementary items only. Through picture clause, developers can undertake two types of editing, namely ZERO Replacement and suppression editing and Insertion editing.

Q.7) What are low values in Cobol?

Low values are the character/characters that occupy the lowest place in the collating sequence of a Cobol program. Low Values signify that there is nothing lower than that specific value in the sequence of the program. Both high and low values are alphanumeric in nature. Therefore, Low Values is essential when you are looking to collate the program sequence alphanumerically.

Q.8) How to sort array in Cobol?

Arrays can be sorted in COBOL by the SORT statement.

Q.9) What is the acronym of Cobol?

COBOL stands for Common business-oriented language.

Q.10) What is level 88 in Cobol?

In Cobol, level 88 signifies a condition-name entry. The programming language assigns level 88 to certain values during execution. Therefore, level 88, in Cobol, does not indicate an item’s name, but the name of the value. No storage reservations exist for level 88s in Cobol. Developers must remember to link level 88 to the data item. Furthermore, it must immediately follow the concerned data item in its Data Division.

Q.11) How to reverse a string in Cobol?

You have two options when it comes to reversing a string in Cobol. 

  • Function Reverse (This is the recommended method for reversing a string).
  • Reference Modification.

If you reverse the string of the word ‘REVERSE’, you will end up with the word ‘ESREVER’.

Q.12) How to add comments in Cobol?

To add a comment in Cobol, you need to put either a slash (/) or an asterisk (*) in the seventh column of the program line. Only DBCS characters can be used to comment. If you use either of these symbols, the program treats any input after column seven as comments. Using the slash will also result in a page eject. Cobol does not check the contents of comment lines, which is why DBCS characters can be used to comment without any issues.

Q.13) Where to use unstring Cobol statement?

Here is a look at some instances where unstring Cobol statements are useful.

  • Unstring statements divide one data item into two or more data items in Cobol.
  • One unstring statement performs the same task as that of several MOVE statements.
  • Unstring statement separates one string into multiple strings. The number of strings depends on the delimiter that you input at the time of entering the unstring statement.

Q.14) How to display the COMP-3 variable in Cobol?

Cobol does not allow you to directly display COMP-3. The only way you can display it is by moving the value into a variable.

Q.15) What is link edit in Cobol?

Link edit, also known as link-edit/binder is responsible for creating an executable program from the output that the compiler compiles. The link-edit option basically binds all of the compilations from the program and creates an executable file. This can be a DLL, or a load module or a Program Object.

Q.16) Explain static and dynamic call in Cobol?

Static call refers to a call statement where the modules called reside within the same load module. This means that when the program transfers control, the called program can be found in the storage. Calling creates a branch. When you place subsequent static calls to the same program, it will be available in its last-used stage.

Dynamic call, on the other hand, refers to a call statement where the called program does not reside in the subprogram, which is link edited to the primary program. In this case, the call is placed to such a program that is link edited with a different load module. Therefore, this program is loaded when a dynamic call is placed.

Q.17) What is the difference between index and subscript in COBOL?

Here is a look at the various differences between index and subscript

Subscript

Index

Number of occurrences of an array

Number of position displacements of an array

Declared in WORKING-STORAGE SECTION

Index may or may not be declared in the WORKING-STORAGE SECTION

Slower in access

Index is faster when compared to Subscript

ADD operator increments Subscript

SET UP BY operator increments Index

Does not require indexation by clause

Occurs along with INDEXED BY clause in used for declaration

Started using MOVE statement

SET operator starts Index

Q.18) How does a redefine work in Cobol?

A re-define clause in Cobol allows you to re-assign data description entries that have already been declared for in the storage area of a computer to a different batch of entries for data description.

Q.19) Why looping statements are used in Cobol?

In Cobol, some tasks need to be performed over and over again. This is known as looping. The PERFORM function is used to create a loop in a Cobol program.

Q.20) What are the types of loops present in Cobol?

There are 4 types of Cobol loops, namely

  • Perform varying
  • Perform until
  • Perform times
  • Perform thru