Cobol interview questions

Question 81: How do you come out of an EVALUATE statement?
Answer : After the execution of one of the when clauses, the control is automatically passed on to the next sentence after the EVALUATE statement. There is no need of any extra code.

Question 82 : In an EVALUATE statement, can I give a complex condition on a w hen clause?
Answer : Yes.

Question 83 : What is a scope terminator? Give examples.
Answer : Scope terminator is used to mark the end of a verb e.g. EVALUATE, END-EVALUATE; IF, END- IF.

Question 84 : How do you do in-line PERFORM?
Answer :

Question 85 : When would you use in-line perform?
Answer : When the body of the perform will not be used in other paragraphs. If the body of the perform is a generic type of code (used from various other places in the program), it would be better to put the code in a separate Para and use PERFORM Para name rather than in-line perform.

Question 86 : How do you define a variable of COMP-1? COMP-2?
Answer : No picture clause to be given. Example 01 WS-VAR USAGE COMP-1.

Question 87 : How many bytes does a S9(7) COMP-3 field occupy ?
Answer : Will take 4 bytes. Sign is stored as hex value in the last nibble. General formula is INT((n/2) + 1)), where n=7 in this example.

Question 88: How many bytes will a S9(8) COMP field occupy ?
Answer : 4 bytes.

Question 89 : What is the maximum value that can be stored in S9(8) COMP?
Answer : 99999999

Question 90 : What is an in line PERFORM? When would you use it? Anything else to say about it?
Answer : The PERFORM and END-PERFORM statements bracket all COBOL II statements between them. The COBOL equivalent is to PERFORM or PERFORM THRU a paragraph. In line PERFORMS work as long as there are no internal GO TOs, not even to an exit. The in line PERFORM for readability should not exceed a page length – often it will reference other PERFORM paragraphs.

Author: user

Leave a Reply

Your email address will not be published. Required fields are marked *