Top 25 COBOL Interview Questions and Answers in 2022


COBOL Interview Questions and Answers

Cobol was one of the most used programming languages in the 1990s. It changed the game when it came out, given that it was created to offer more portability and readability. On portability, it allows the running of programs without much modification from different computer brands. Readability means that it allows programs to be easily read.

It can be quite difficult to ace a Cobol language without the right preparation, which explains why we decided to cover some of its commonly asked questions. Here are a few questions that will help you prepare for your upcoming interview:

1. Define COBOL

COBOL is a popular language that was invented to offer more readability and portability for programs. It is fully known as the Common Business Oriented Language and gained popularity in the 90s. It is generally used for business purposes to solve complex problems. It has been greatly applied in finance, administrative systems, and government functions.

2. Can You Mention The Data Types In COBOL?

COBOL has three main data types that it relies on for its purposes. They include Numeric (X), which represents numeric values from 0 to 9 used in COBOL programming; Alphabetic, which has several alphabetic variables between A- Z and alphanumeric that summarize the other two data types, meaning that it can hold both alphabetic and numeric values together.

3. Do You Think That COBOL Is Worth Learning?

COBOL is still a language worth considering, given that its main objectives are the readability and portability of programs. It revolutionized programming as it is one of the oldest programming languages. It can be easily maintained or ported to other programming languages, explaining why government agencies mostly use it. The United States government widely used COBOL during the COVID 19 pandemic for the issuance of unemployment benefits, which may have inspired a whole new interest in it.

Why Should We Hire You? 5 Best Answ...
Why Should We Hire You? 5 Best Answers

4. Can You Mention The Main Characters Of COBOL?

COBOL has several characteristics, given that it is a business-oriented application. Most of these characteristics are aimed at managing and updating business data. It is highly portable, meaning that it can be easily compiled, executed, and brought together on different machines where necessary. It is also suited for handling large data volumes, which explains its data types. Thanks to its debugging and testing abilities, it can also come in handy when searching for solutions. Lastly, COBOL is simple. It has a simple and wide vocabulary, which makes it an easy language to learn.

5. Why Would You Advise People To Use COBOL?

There are several reasons why COBOL is worth learning and using. First, it has existed for over 60 years, making it one of the oldest programming languages. It has also been adapted to many products and platforms, making it highly versatile and fit for different use cases. Additionally, it has several business-oriented capabilities, as it can handle huge volumes of data and perform heavy processing operations. Lastly, COBOL is highly scalable thanks to its easy-to-read, modify and debug control frameworks, making it highly dependable.

6. There Are Two Main Types Of COBOL, The OS/VS COBOL And The VS COBOL II. Can You Tell The Differences?

Having used both, I can confidently say there are many differences between the two. The former runs in 24-bit addressing mode, while the latter is capable of running in 24- and 31-bit addressing modes. OS/VS additionally supports report writer while the latter does not support Report Writer. Other things supported by OS/VS and not VS COBOL II are USAGE IS POINTER, EVALUATE and scope terminators. Lastly, OS/VS follows ANSI 74 standards while its counterpart supports ANSI 85.

7. Mention The Object-Oriented Features In COBOL

COBOL has several Object-Oriented features, making it one of the most scalable programming languages. They include inheritance, data encapsulation born from its ability to create objects and maximum flexibility through polymorphism and defining interfaces. Other features include compatibility with procedural programming, defining class object behaviors through methods and classes while letting programs define and create the relevant objects. In data encapsulation, all data properties are usually encapsulated in the objects during and after their creation.

8. There Are Four Divisions In COBOL Programs. Please Mention Them

The four main divisions in a COBOL Program are the data division, identification division, procedure division and environment division. A program’s primary logic is supported by the procedure division, which should have a minimum of one statement for user-defined variables support. The data division identifies all the data items, making it responsible for memory allocation and the name defined within the program. On the other hand, the environment division is responsible for defining the written program’s environment and is categorized in configuration and input-output. Lastly, the identification division, the most important division, identifies the programs. It has to be there for the running of every COBOL program as it helps in the compilation.

9. What Are The Two Main Approaches To Processing Two Files By Computing Key Fields?

The first approach, which is the easiest, demands that records are read from both files and later ignored if the key fields match. However, if they don’t, the files with the missing or new records are identified and updated. In approach 2, work is reduced when both files have matching records. However, if the first file comes to the ‘at end’ state, ‘high values’ are moved into the key field, similar to the second file. It is a continuous method that must be done till all key fields are equal. However, the key fields must be in PIC(X) format.

10. Structured COBOL Is Not Similar To Object-Oriented COBOL. Mention The Differences

There are three main differences between structured and object-oriented COBOL programming. In structured, all functionalities are broken down into modules, while object-oriented COBOL programming is done logically, which plays a big role in writing clean code logic. The former is also more natural, unlike the latter. Additionally, structured COBOL programming is usually less secure because it lacks a data hiding feature. In contrast, Object-oriented COBOL programming is more secure since it first defines objects and writes their functionalities.

11. Mention Some Of The Causes Of SOC7 And SOC5

There are three main causes of SOC7. It happens when numeric operations are conducted in non-numeric data, when working on non-initialized storage and whenever one’s coding attempts exceed the maximum allowed dub script. On the other hand, SOC5 occurs due to damaged subscript or index, access of I/O before the read operation, an attempt to close an unopened dataset and whenever a perform operation incorrectly exits.

12.Ordered Sequential Files Bring About a Few Problems. Can You Mention Them?

The main reason we normally experience a problem when using ordered sequential files is their nature, as the records follow specific key fields. The given order must be maintained when performing useful operations such as deletion or insert. However, to do that, a new file must be created for deleting or updating objects and maintaining the original file order, which directly happens on the disk. The main challenge is that more time is often required to access data on the disk when processing functionality, thus reducing computation speed. It also slows down the system whenever such files are used without any need.

13. There Are Several Commands In COBOL. Some Of These Are The INCLUDE And COPY Commands. Can You Differentiate Them?

The main difference between COPY and INCLUDE in COBOL is that while INCLUDE is used for code expansion during pre-compilation, COPY does the same when it’s time for compilation. Since the included DB2 can barely process COPY statements, INCLUDE is often used to handle statements requiring table attributes and for embedding DCL statements. All in all, INCLUDE and COPY both play a great role in expanding program codes and variables.

14. Can You Define What AMODE (31), AMODE (24), RMODE (24) And RMODE(ANY) Are?

All four are important options used in compiling and link editing. AMODE fully means addressing mode, while RMODE is the resident mode within the virtual shortage. Therefore, AMODE (31) and (24) are the addressing modes in 31-bit and 24-bit systems. However, AMODE(ANY), like the alphanumeric data type, allows the usage of both 31-bit and 24-bit addressing modes. However, they are dependent on the RMODE.

The RMODE also follows the same logic, just that it is slightly different. Therefore, RMODE (24) shows that the mode can exist within virtual storage of 16 Meg line and below, while its counterpart, RMODE(ANY), is a sign that the address bit can either be 24 or 31 as defined by the RMODE.

15. Mention Some Of The Most Important Guidelines To Be Followed When Writing A Structured COBOL Program?

There are four main guidelines that everyone writing a structured COBOL Program should follow. First, the ‘EVALUATE’ statement should be used when constructing cases. For nesting, scope terminators should be used and ‘do’ constructions should be written using an in-line perform statement. Lastly, Test After and Before should be used in the perform statement for writing Do-While statements.

16. Differentiate Between Binary And Sequential Search

In binary search, we use the item at the center to compare the item being searched. A match gives the green light to use the value. However, if they don’t match, the process should be repeated depending on the item’s location, which can either be the left or right half. The sequential search takes a top-to-bottom approach in searching the table, making it optional for elements to be in a given sequence. As a result, it is easier to perform the binary search for several tables and sequential for a smaller number of tables.

17. What Do You Know About INPUT And OUTPUT Procedures?

There are two main procedures in COBOL, the INPUT and OUTPUT Procedures. These two procedures differ on the file getting opened and the following actions, i.e., for the input procedure, the input file gets opened, and records are read and edited. In contrast, for the OUTPUT Procedures, the output file gets opened, the sorted record returned, and the record is finally written. The file is then closed, unlike in the first procedure where it is edited.

18. Can You Explain How Sorting Is Done On A COBOL Program?

There are several ways of sorting in COBOL: syntax, SORT File- 1 on ascending/descending key, USING file-2, GIVING file-3. The last two can be substituted by INPUT PROCEDURE IS and OUTPUT PROCEDURE IS para-1 THRU para-2, respectively. File 1, the sort work file, is generally described in the FILE SECTION via SD entry, while file 2 acts as the input file for SORT. It is usually described in FILE CONTROL using an FD entry in SELECT and FILE SECTION clauses. An FD Entry usually describes File-3 in the formerly- mentioned clauses. However, these three files should not be explicitly opened.

19. Mention Some Of The Shortcomings Of COBOL

Despite being one of the best business-oriented languages, COBOL also has its disadvantages worth noting down. First, a COBOL program takes a long time to compile, giving machine-oriented programming languages the edge. It is also designed to handle business-related projects and requirements, not scientific applications, which limits it. Additionally, COBOL has an extremely rigid framework which can make it inconvenient for a beginner and lastly, its syntax is quite wordy.

20. Can You Mention The Syntax Rules Of COBOL?

COBOL is generally compared to the standard English language, given its syntax. It is highly readable and self-documenting but comes with its own syntax rules. First, it has more than three hundred words and is not a case-sensitive language. To abbreviate complex conditions, one only has to remove repeated variables and conditions. This programming language also lacks a huge standard library, given that it has 87 functions, 43 statements and a single class. Lastly, COBOL has more than 300 reserved words.

21. What Do You Understand By Variables In COBOL?

Variables are named locations in COBOL’s memory where programs can store or retrieve data. They are generally described depending on their sizes and types and must be encrypted in the data division. The memory area reserved for a variable is normally called a data name or identity. Several rules must be followed when declaring variables. First, they should be declared in working-storage sections and can therefore be records, arrays and file descriptor records. Second, variable names should be alphanumeric, with the first character as an alphabet. When declaring variables, it is also important to remember that a single fight number should be represented by nine. Lastly, only a few special characters can have a hyphen, which by rule has to be embedded.

22. Can You Mention The Different Components Of COBOL?

There are six main components of COBOL: divisions, sections, sentences, paragraphs, statements and characters. Divisions are blocks of codes with one or more sections that begin where the name is encountered and end when the next division begins. On the other hand, sections are the logical subcategories of the program logic. Paragraphs make up sections and can be defined as the portions of selections with user-defined or predefined names. Sentences are made up of single or several statements found in the procedure division, generally ending with a period, while statements are used to perform processing. Lastly, characters make up statements and are often indivisible.

23. Can You Differentiate Between The Identification Division And The Environment Division?

There are several divisions in the COBOL Program, including identification and the environment. The identification division is the most important as it is used by both the compiler and programmer to recognize a program. It also identifies the name of the program with characters. On the other hand, the environment division is used to identify input and output files. It has the configuration section, which contains information regarding the system where a program is written and run, and the input-output sections, which contain details regarding the files used in the program.

24.  Can You Mention The Different Mini-Sections Of The Input-Output Sections?

The input-output section of the environment division has four mini-sections: file section, working storage section, linkage section and the local-storage section. The linkage section has the data names from the external storage, while the file section is used to define a file’s record structure. On the other hand, the working storage section is used to declare file structures and temp variables, while the local-storage section is similar to the working storage section, just that it must be initialized whenever a program starts executing.

25. Can You Mention Some Of The Coding Rules Of COBOL?

There are four main coding rules when using COBOL. First, the first six-character positions should be allocated for sequence numbers, while the seventh character position is allocated for the continuation character or a comment line denoting an asterisk. While coding, it’s important also to remember that positions 8-11 are known as Area A while 12-72, Area B. Lastly, it’s only at column 8 that the actual real program begins.

Conclusion

These are some of the most asked questions in COBOL interviews. Make sure you sharpen your COBOL knowledge before the interview, given that some of these questions can be difficult to answer without the right preparations. We wish you all the best!

Recent Posts