Common Business Oriented Language (COBOL) is one of the oldest programming languages used in commercial applications. It was created to improve the portability and readability of code across mainframe systems. Although it has been around for decades, it is still relevant since it solves complex business problems efficiently.
Let’s look at the top COBOL interview questions that can guide freshers and experienced professionals while preparing for job opportunities.
Top COBOL Interview Questions and Answers for 2022
1. What is COBOL?
COBOL is one of the oldest programming languages. COBOL converts high-level source code from other languages into simple machine code that is easily understood by the computer. In other words, COBOL receives data, processes it, and generates output. Portability across different platforms is a key feature of COBOL. It is a reliable and highly scalable programming language with control structures to read, debug and modify easily.
2. What is the difference between NEXT SENTENCE and CONTINUE statements?
NEXT SENTENCE is used to pass on the control to the next statement, whereas CONTINUE is used as a null statement to carry on the execution.
3. State the difference between GOBACK and STOP RUN.
STOP RUN gives control back to the operating system and terminates the execution of a program. In a standalone module, GOBACK performs the same function as STOP RUN. However, when used within a sub module, GO BACK gives the control back to the main module.
4. What is the difference between COBOL and COBOL II?
Structured programming is supported by COBOL II. COBOL II does not support features like Report Writer and Ready Trace, whereas it supports EVALUATE, USAGE IS POINTER, and scope terminator that COBOL does not support .COBOL and COBOL II follow ANSI 74 and 85 standards, respectively. COBOL II supports calls between the programs under the Customer Information Control System (CICS) and reference modifications that are not supported by COBOL. COBOL II runs in either 24-bit or 31-bit addressing mode, while COBOL only runs in 24-bit addressing mode.
5. Explain the COBOL Program Structure.
The below diagram demonstrates the COBOL program structure:
6. Explain what a scope terminator is.
A scope terminator is used to end a statement. It can be explicit or implicit. Explicit Scope Terminators include END followed by a hyphen and the verb that is terminated. E.g. END-IF. A period (.) that ends all the previous open statements is the Implicit Scope Terminator.
7. What are static and dynamic linking?
Static Linking means that a program or sub-program is held as an object in an executable file but cannot be referenced by another executable file. On the other hand, Dynamic Linking refers to a dynamically loadable program that can be executed without linking it. This is achieved through the dynamic loader routine supported by the run-time system that can link to an executable object file and run a dynamically linked program or sub-program. The sub-programs do not exist as independent modules in static linking and are embedded in the main program. Whereas in dynamic linking, they are not linked to the main program and exist as separate modules.
8. How are index and subscript different?
Subscript refers to the number of times an array occurs, while index refers to the number of dislocation positions of an array. The Index is faster in accessing items from the data table compared to subscript. MOVE statement is used to initialize a subscript, whereas the index is initialized using SET statement.
9. Name the sections of the data division.
The data division comprises six sections:
10. What is the difference between SSRANGE and NOSSRANGE?
SSRANGE is used to locate a subscript that is out of range and manage array overflow. NOSSRANGE ensures no run-time error if a subscript or index is out of range. NOSSRANGE is the default option for critical applications.
11. What is meant by structured programming and object-oriented programming in COBOL?
Structured programming follows the logical programming approach and is less secure. In this approach, the functionalities are segregated into modules.
Object-oriented programming follows the natural programming approach. In this approach, the objects are identified before writing functions and procedures. Due to the data concealing mechanism used by this approach, it is more secure than structured programming.
12. What are the rules of writing a structured COBOL program?
In order to write a structured COBOL program, the following are the rules to be followed:
- Use scope terminators while nesting statements
- Build cases using EQUIVALENT statement
- When DO structures are used, use IN-LINE PERFORM statements
- USe TEST BEFORE and TEST AFTER statements while writing DO-WHILE statements
13. Explain the difference between NEXT SENTENCE and CONTINUE statements.
The NEXT SENTENCE comprises a group of sentences ending with a period, and it is used to control the verb appearing after the next period. The CONTINUE statement is used after the explicit scope terminator to control the verb appearing next.
The input count does not increase when the NEXT SENTENCE statement is used, while it is increased by one when the CONTINUE statement is used.
14. What is the use of the REPLACING option in the COPY statement?
The REPLACING option allows the same copy to be used several times by editing the replace value.
15. List some of the rules for searching.
- The OCCURS clause in the table is needed to conduct a search function
- The phrase INDEXED BY must be used
- The index value must be set to 1
1. What are the four divisions in COBOL?
- Identification Division
- Data Division
- Environment Division
- Procedure Division
2. Is there any future in COBOL?
Yes. Although COBOL is one of the oldest programming languages (more than 60 years old), it is still used in mainframes since it enables code portability and readability. COBOL is used for transaction processing and report generation across many industries, and many legacy systems running on mainframes still use COBOL. Replacing these systems will be a huge cost and until newer technology is developed to replace them, there is a future in COBOL.
3. Is STOP RUN mandatory in COBOL?
Yes. STOP RUN is used to return control to the system, and it closes the tasks that are run by the program.
4. What is a COBOL copybook?
A COBOL copybook is a section of code that defines the data structures of COBOL programs.
5. Name the data types available in COBOL?
Below are the data types available and the values they represent:
- Numeric: Numerical values between 0-9
- Alphabetic: Alphabetical values A-Z
- Alphanumeric:: Both numeric & alphabetical values
6. What is the difference between section & paragraph?
A section is a logical division of a program and includes paragraphs. A paragraph is the subdivision of a section or division and includes 0 or more sentences. When a section is performed, all paragraphs within that section will be performed. A paragraph will only perform that particular paragraph.
7. What is Pic 9v99?
It indicates a three-digit numeric value with a decimal point after the first digit indicated by v.
8. Explain the use of the IS NUMERIC clause?
IS NUMERIC clause is used to determine if a value is numeric or not.
9. What are levels 66, 77 and 88 used for?
Level 66 - used for renaming
Level 77 - It is elementary level variables/data items
Level 88 - used for Conditional names
10. Which components are mandatory for a COBOL program?
PROGRAM-ID paragraph and IDENTIFICATION division are mandatory to compile a COBOL program without errors.
11. What is COBOL’s length?
A specific register holds the length of a group or a basic item.
Now that you have gone through the top COBOL interview questions and answers, you can now go ahead and answer the interviews with confidence at your dream companies. If you are looking to further enhance your skills as a software developer, then we highly recommend Simplilearn’s Post Graduate Program in Full Stack Web Development which is designed in collaboration with Caltech CTME. This bootcamp will help you gain all the required skills and kickstart your career as a skilled software developer in just 6 months. Enroll Now!
If you have any questions regarding the article or the course, feel free to post them in the comments section below and our team will get back to you at your earliest.