Cobol interview questions

Question 41 :Why occurs can not be used in 01 level ?
Answer : Because, Occurs clause is there to repeat fields with same format, not the records.

Question 42 : What is the difference between CONTINUE & NEXT SENTENCE ?
Answer : They appear to be similar, that is, the control goes to the next sentence in the paragraph. But, Next Sentence would take the control to the sentence after it finds a full stop (.). Check out by writing the following code example, one if sentence followed by 3 display statements (sorry they appear one line here because of formatting restrictions) If 1 > 0 then next sentence end if display ‘line 1’ display ‘line 2’. display ‘line 3’. *** Note- there is a dot (.)
only at the end of the last 2 statements, see the effect by replacing Next Sentence with Continue ***

Question 43: What does EXIT do ?
Answer : Does nothing – If used, must be the only sentence within a paragraph.

Question 44 : How is sign stored in Packed Decimal fields and Zoned Decimal fields?
Packed Decimal fields: Sign is stored as a hex value in the last nibble (4 bits ) of the storage. Zoned Decimal fields: As a default, sign is over punched with the numeric value stored in the last bite.

Question 45: How is sign stored in Packed Decimal fields and Zoned Decimal fields?
Answer : Packed Decimal fields: Sign is stored as a hex value in the last nibble (4 bits ) of the storage.
Zoned Decimal fields: As a default, sign is over punched with the numeric value stored in the last bite.

Question 46 : When is a scope terminator mandatory?
Answer : Scope terminators are mandatory for in-line PERFORMS and EVALUATE statements. For readability, it’s recommended coding practice to always make scope terminators explicit.

Question 47 : What is the difference between a DYNAMIC and STATIC call in COBOL.
Answer : To correct an earlier answer: All called modules cannot run standalone if they require program variables passed to them via the LINKAGE section. DYNAMICally called modules are those that are not bound with the calling program at link edit time (1EWL for IBM) and so are loaded from the program library (joblib or steplib) associated with the job. For DYNAMIC calling of a module the DYNAM compiler option must be chosen, else the linkage editor will not generate an executable as it will expect u address resolution of all called modules. A STATICally called module is one that is bound with the calling module at link edit, and therefore becomes part of the executable load module.

Question 48 :How may divisions are there in JCL-COBOL?
Answer : SIX

Question 49: What is the purpose of Identification Division?
Answer : Documentation.

Question 50: Name the divisions in a COBOL program ?.
Answer : IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION, PROCEDURE DIVISION.

Author: user

Leave a Reply