Most Asked Cobol Interview Questions and Answers
Why is it necessary that file needs to be opened in I-O mode for REWRITE?
Before the REWRITE is performed, the record must be open and read from the file. Therefore, the file must be opened in I-O mode for rewrite functionality.
How can we find that module can be called – whether DYNAMICALLY or STATICALLY?
The ONLY way is to look at the output of the linkage editor or the load module.
If the module is being called DYNAMICALLY then it will not exist in the main module, if it is being called STATICALLY then it will be exist in the load module.
Which Search verb is equivalent to PERFORM…VARYING?
The serial SEARCH verb is equivalent to Perform.. Varying statement and it is nothing but search without ALL.
How many Sections are there in Data Division?
There are six sections in Data Division:
- File Section
- Working Storage Section
- Local Storage Section
- Screen Section
- Report Section
- Linkage Section
What is the difference between comp and comp-3 usage?
Comp is for binary usage, while comp-3 indicates packed decimal.
What does Exit do?
If EXIT is used, it won’t be more than only sentence within a paragraph.
Give some examples of command terminators?
End IF and End Evaluate are the examples of command terminators.
What is the difference between Call and a Link?
A call is an actual COBOL command which provokes an external program and returns. Link is same as Call but it does not belong to a COBOL verb.
Which mode is used to operate the sequential file?
An O-I mode (Output/Input mode) is used for starting and initiation of processing files. Processing of files is determined by successful execution of an OPEN statement.
How many bytes S(8) comp field occupy and its maximum value?
S(8) can store 4 bytes and the highest value is 99999999.
How arrays can be defined in COBOL?
Arrays can be defined as –
05 Array1 PIC X(9) which occurs 10 times
05 Array2 PIC X(9) which occurs 20 times
What are literals?
A literal is a data item which consists value by itself. It cannot be referred by a name. They are constant data items. There are two types of literals:
- String / Alphanumeric Literals
- Numeric Literals
What is a report item?
A report item is a field to be printed which has Edit Symbols.
Can we redefine the field of X(200) to less than 200?
Yes, we can redefine the values from bigger number to smaller number.
What is length is Cobol?
Length is like a special register to have the length of a group or an elementary item