Cobol interview questions

Question 11: What is the difference between a binary search and a sequential search? What are the pertinent COBOL commands?
Answer : In a binary search the table element key values must be in ascending or descending sequence. The table is ‘halved’ to search for equal to, greater than or less than conditions until the element is found. In a sequential search the table is searched from top to bottom, so (ironically) the elements do not have to be in a specific sequence. The binary search is much faster for larger tables, while sequential works well with smaller ones. SEARCH ALL is used for binary searches; SEARCH for sequential.

Question 12 : What is the point of the REPLACING option of a copy statement?
Answer : REPLACING allows for the same copy to be used more than once in the same code by changing the replace value.

Question 13: What will happen if you code GO BACK instead of STOP RUN in a stand alone COBOL program i.e. a program which is not calling any other program.
Answer : The program will go in an infinite loop.

Question 14 : How can I tell if a module is being called DYNAMICALLY or STATICALLY?
Answer : The ONLY way is to look at the output of the linkage editor (IEWL)or the load module itself. 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 seen in the load module. Calling a working storage variable, containing a program name, does not make a DYNAMIC call. This type of calling is known as IMPLICITE calling as the name of the module is implied by the contents of the working storage variable. Calling a program name literal (CALL

Question 15 : What are the different data types available in COBOL?
Answer : Alpha-numeric (X), alphabetic (A) and numeric (9).

Question 16 : What does the INITIALIZE verb do? – OS
Answer : Alphabetic, Alphanumeric fields & alphanumeric edited items are set to SPACES. Numeric, Numeric edited items set to ZERO. FILLER , OCCURS DEPENDING ON items left untouched.

Question 17: What is 77 level used for ?
Answer : Elementary level item. Cannot be subdivisions of other items (cannot be qualified), nor can they be subdivided themselves.

Question 18: What is Static and Dynamic linking ?
Answer : In static linking, the called subroutine is link-edited into the calling program , while in dynamic linking, the subroutine & the main program will exist as separate load modules. You choose static/dynamic linking by choosing either the DYNAM or NODYNAM link edit option. (Even if you choose NODYNAM, a CALL identifier (as opposed to a CALL literal), will translate to a DYNAMIC call).A statically called subroutine will not be in its initial state the next time it is called unless you explicitly use INITIAL or you do a CANCEL. A dynamically called routine will always be in its initial state.

Question 19: What compiler option would you use for dynamic linking?
Answer : DYNAM.

Question 20: What is SSRANGE, NOSSRANGE ?
A54) These are compiler options with respect to subscript out of range checking. NOSSRANGE is the default and if chosen, no run time error will be flagged if your index or subscript goes out of the permissible range.

Author: user

Leave a Reply