Cobol interview questions

Question 71) Can the OCCURS clause be at the 01 level?
Answer : No.

Question 72 : What is the difference between index and subscript?
Answer : Subscript refers to the array occurrence while index is the displacement (in no of bytes) from the beginning of the array. An index can only be modified using PERFORM, SEARCH & SET. Need to have index for a table in order to use SEARCH, SEARCH ALL.

Question 73: What is the difference between SEARCH and SEARCH ALL?
Answer :
SEARCH – is a serial search.
SEARCH ALL – is a binary search & the table must be sorted ( ASCENDING/DESCENDING KEY clause to be used & data loaded in this order) before using SEARCH ALL.

Question 74 : What should be the sorting order for SEARCH ALL?
Answer : It can be either ASCENDING or DESCENDING. ASCENDING is default. If you want the search to be done on an array sorted in descending order, then while defining the array, you should give DESCENDING KEY clause. (You must load the table in the specified order).

Question 75 : How do we get current date from system with century?
Answer : By using Intrinsic function, FUNCTION CURRENT-DATE

Question 76: What is the maximum length of a field you can define using COMP-3?
Answer : 10 Bytes (S9( 18) COMP-3).

Question 77: What is the difference between Structured COBOL Programming and Object Oriented COBOL programming?
Answer : Structured programming is a Logical way of programming, you divide the functionalities into modules and code logically. OOP is a Natural way of programming; you identify the objects first, and then write functions, procedures around the objects. Sorry, this may not be an adequate answer, but they are two different programming paradigms, which is difficult to put in a sentence or two.

Question 78 : What divisions, sections and paragraphs are mandatory for a COBOL program?
Answer : IDENTIFICATION DIVISION and PROGRAM-ID paragraph are mandatory for a compilation error free COBOL program.

Question 79 : Can JUSTIFIED be used for all the data types?
Answer : No, it can be used only with alphabetic and alphanumeric data types.

Question 80: Can JUSTIFIED be used for all the data types?
Answer : No, it can be used only with alphabetic and alphanumeric data types.

Author: user

Leave a Reply