COBOL Interview Questions and Answers
Ques 36. What is the purpose of the EXIT PROGRAM statement?
The EXIT PROGRAM statement in COBOL is used to terminate the entire program. It is often used in conjunction with a condition or as part of an error-handling routine.
Example:
IF ERROR-FLAG = 'Y' THEN
EXIT PROGRAM.
END-IF.
Ques 37. Explain the concept of the UNSTRING statement in COBOL.
The UNSTRING statement in COBOL is used to break down a delimited string into its individual components. It is useful for parsing and extracting data from strings.
Example:
UNSTRING NAME-STRING DELIMITED BY ',' INTO FIRST-NAME LAST-NAME.
Ques 38. What is the significance of the RESERVE statement in COBOL?
The RESERVE statement in COBOL is used to allocate storage space for large data items. It ensures that sufficient memory is reserved to accommodate the specified data.
Example:
01 LARGE-DATA PIC X(1000).
RESERVE 1000 CHARACTERS FOR LARGE-DATA.
Ques 39. Explain the concept of the CALL statement in COBOL.
The CALL statement in COBOL is used to invoke subprograms or procedures from other programs. It allows modular programming and code reuse.
Example:
CALL 'SUB-PROGRAM' USING PARAMETER-1 PARAMETER-2.
Ques 40. What is the role of the END-IF statement in COBOL?
The END-IF statement in COBOL marks the end of an IF statement block. It is used to indicate the conclusion of the conditional code and resume normal program flow.
Example:
IF AMOUNT > LIMIT
DISPLAY 'Amount exceeds limit'
END-IF.
Most helpful rated by users: