- COBOL Tutorial
- COBOL - Home
- COBOL - Overview
- COBOL - Environment Setup
- COBOL - Program Structure
- COBOL - Basic Syntax
- COBOL - Data Types
- COBOL - Basic Verbs
- COBOL - Data Layout
- COBOL - Conditional Statements
- COBOL - Loop Statements
- COBOL - String Handling
- COBOL - Table Processing
- COBOL - File Handling
- COBOL - File Organization
- COBOL - File Access Mode
- COBOL - File Handling Verbs
- COBOL - Subroutines
- COBOL - Internal Sort
- COBOL - Database Interface
- COBOL Useful Resources
- COBOL - Questions and Answers
- COBOL - Quick Guide
- COBOL - Useful Resources
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
COBOL Interview Questions
Dear readers, these COBOL Interview Questions have been designed especially to get you acquainted with the nature of questions you may encounter during your interview for the subject of COBOL Programming Language. As per my experience, good interviewers hardly plan to ask any particular question during your interview. Normally questions start with some basic concept of the subject and later they continue based on further discussion and what you answer:
COBOL stands for Common Business-Oriented Language. The US Department of Defense, in a conference, formed CODASYL (Conference on Data Systems Language) to develop a language for meeting business data processing needs which is now known as COBOL.
COBOL is a standard language that can be compiled and executed on various machines. It is ideally suited for business-oriented applications as it can handle huge volumes of data. It provides numerous debugging and testing tools. COBOL is a structured language; it has different divisions, so it is easy to debug.
Identification Division, Environment Division, Data Division, and Procedure Division.
Alpha-numeric (X), Alphabetic (A), and Numeric (9).
IS NUMERIC clause is used to check if any item is numeric or not. It returns TRUE when the item against which it is used contains only numbers (0 to 9). The item can be positive or negative.
Level 66 is used for RENAMES clause and Level 88 is used for condition names.
Subscript is the occurrence in an array. Index is the displacement from the beginning of an array.
SEARCH is a serial search, whereas SEARCH ALL is a binary search. A table must be in sorted order before using SEARCH ALL.
Performing a SECTION will cause all the paragraphs that are a part of the section to be performed. Performing a PARAGRAPH will cause only a particular paragraph to be performed.
Scope terminator is used to mark the end of a verb. Example: IF and END-IF.
File opening modes in COBOL include: INPUT, OUTPUT, I-O, and EXTEND.
The maximum size of a numeric field is PIC 9(18).
CONTINUE transfers the control to the next statement after the scope terminator. NEXT SENTENCE transfers the control to the statement after the first period is encountered.
01 is of the record level. We repeat the fields within a record, not the record itself. So an Occurs clause can not be used at 01 level.
To write into a file, the file has to be opened in either OUTPUT or EXTEND mode.
The parameters passed in a Call By Content are protected from modification by the called program. In Call By Reference, parameters can be modified by the called program.
The linkage section is a part of a called program that 'links' or maps to data items in the calling program's working storage.
The program will go in an infinite loop.
It is stored in the last nibble.
Comp is a binary usage, while comp-3 indicates packed decimal.
Identification Division is used for documentation purpose.
In static call, the called program is a standalone program, it is an executable program. During runtime, we can call it in our called program. As about dynamic call, the called program is not an executable program; it can be executed through the called program only.
Redefines clause is used to allow the same storage allocation to be referenced by different data names.
The Purpose of Pointer phrase is to specify the leftmost position within the receiving field where the first transferred character will be stored.
It is an elementary level item which cannot be subdivided.
Compare the item to be searched with the item at the centre. If it matches fine; else repeat the process with the left half or the right half depending on where the item lies.
Evaluate is like a case statement and can be used to replace nested Ifs. No break is required as the control comes out as soon as a match is found.
Yes, as Redefines causes both fields to start at the same location.
COMP-1 is single precision floating point that uses 4 bytes. COMP-2 is double precision floating point that uses 8 bytes.
Accept Verb is used to get data such as date, time, and day from the operating system or directly from the user. If a program is accepting data from the user, then it needs to be passed through the JCL.
Compute statement is used to write arithmetic expressions in COBOL. This is a replacement for Add, Subtract, Multiply, and Divide.
Supply the DD cards in JCL just as you would for files referred to in the main program.
Identification Division and Program-Id paragraph are mandatory in a COBOL program.
Area B starts from 12 to 72 column.
It appears in the Input-Ouput Section in the Environment Division.
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 each repeated execution of the PERFORM range. The range is executed at least once in TEST AFTER.
Local-Storage is allocated each time a program is called and will be deallocated when the program stops via an EXIT PROGRAM, GOBACK, or STOP RUN. It is defined in the DATA DIVISION after the WORKING-STORAGE SECTION.
Access modes are SEQUENTIAL or DYNAMIC for the start statement.
PIC 9.99 is a four position field that actually contains a decimal point whereas PIC 9v99 is a three position numeric field with assumed decimal position.
No, the table must be indexed to search on a table.
Before REWRITE is performed, the record must be opened and read from the file. Therefore, the file must be opened in I-O mode for rewrite functionality.
A literal is a data item that consists value by itself. It cannot be referred by a name. They are constant data items.
A Stop run ends the unit of work and returns control to the operating system whereas GOBACK returns control to calling program. So if we code GO BACK instead of Stop Run, it will go in infinite loop.
To write into a file, the file has to be opened in either OUTPUT or EXTEND mode.
FILE-CONTROL paragraph appears in the Input-Ouput Section in the Environment Division which provides information of external data sets used in the program.
Length of PIC 9.999 is 5 as '.' takes 1 byte. So total 1 byte for '.' and 4 bytes for 9.
Rewrite verb is used to update the records. File should be opened in I-O mode for rewrite operations. It can be used only after a successful Read operation. Rewrite verb overwrites the last record read.
.00123 edited value will be taken. P is assumed decimal scaling position which is used to specify the location of an assumed decimal point when the point is not within the number that appears in the data item. .PIC PP999 means that numeric data item is of 3 characters and there are 5 positions after the decimal point.
In array declaration, we can specify occurs clause on Elementary item as well as on Group item also.
9(7) will take 7 bytes and 1 byte for SIGN TRAILING SEPARATE, so total 8 bytes it will take.
What is Next?
Further, you can go through the examples which you have practised with the subject and make sure you are able to speak confidently on them. If you are fresher, then the interviewer does not expect you to answer very complex questions, rather you have to make your basics very strong.
It really doesn't matter much if you could not answer a few questions, but it matters how you answered, the ones that you did. So just be confident during your interview. We at tutorialspoint wish you all the very best.