Adsnese

Ad

Wednesday, September 17, 2008

Cobol Interview Questions Part-7

101.How many Sections are there in Data Division?.

Ans: SIX SECTIONS 1.'FILE SECTION' 2.'WORKING-STORAGE SECTION' 3.'LOCAL-STORAGE SECTION' 4.'SCREEN SECTION' 5.'REPORT SECTION' 6.'LINKAGE SECTION'

In COBOL II, there are only 4 sections. 1.'FILE SECTION' 2.'WORKING-STORAGE SECTION' 3.'LOCAL-STORAGE SECTION' 4.'LINKAGE SECTION'.

102. How can I tell if a module is being called DYNAMICALLY or STATICALLY?

Ans: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).

103. What is the difference between a DYNAMIC and STATIC call in COBOL.

Ans: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 (IEWL 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 null 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.

104. What is the difference between PIC 9.99 and 9v99?

Ans:PIC 9.99 is a FOUR-POSITION field that actually contains a decimal point where as PIC 9v99 is THREE-POSITION numeric field with implied or assumed decimal position.

105. How is PIC 9.99 is different from PIC 9v99?

Ans:PIC 9.99 is a four position field that actually contains a decimal point where as 9v99 is a three position numeric field with an implied or assumed decimal point.

106. what is Pic 9v99 Indicates?

Ans:PICTURE 9v99 is a three position Numeric field with an implied or assumed decimal point after the first position; the v means an implied decimal point.

107. what guidelines should be followed to write a structured COBOL program?

Ans:1) Use 'EVALUATE' stmt for constructing cases. 2) Use scope terminators for nesting. 3)Use in-line Perform stmt for writing 'do ' constructions. 4) Use Test Before and test after in the Perform stmt for writing Do-While constructions.

108. Read the following code.

01 ws-n PIC 9(2) value zero.

a-para.

move 5 to ws-n.

perform b-para ws-n times.

b-para.

move 10 to ws-n.

How many times will b-para be executed ?

Ans: 5 Times only. it will not take the value 10 that is initialized in the loop.

109. What are some examples of command terminators?

Ans: END-IF, END-EVALUATE

110.What care has to be taken to force program to execute above 16 Meg line?

Ans: Make sure that link option is AMODE=31 and RMODE=ANY. Compile option should never have SIZE(MAX).BUFSIZE can be 2K, efficient enough.

111.Give some advantages of REDEFINES clause.

Ans: You can REDEFINE a Variable from one PICTURE class to another PICTURE class by using the same memory location. By REDEFINES we can INITIALISE the variable in WORKING-STORAGE Section itself.3. We can REDEFINE a Single Variable into so many sub-variables.(This facility is very useful in solving Y2000 Problem.)

112.Why do we code s9(4)comp. Inspite of knowing comp-3 will occupy less space.

Ans: Here s9(4)comp is small integer ,so two words equal to 8 bytes. Totally it will occupy 2 bytes(4 words).here in s9(4) comp-3 as one word is equal to 1/2 byte.4 words equal to 2 bytes and sign will occupy 1/2 bytes totally it will occupy 3 bytes.

113. The maximum number of dimensions that an array can have in COBOL-85 is ________.

Ans: SEVEN in COBOL - 85 and THREE in COBOL - 84

114. Name the divisions in a COBOL program.

Ans: IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION, PROCEDURE DIVISION.

115. What are the different data types available in COBOL?

Ans: Alpha-numeric (X), alphabetic (A) and numeric (9).

116. What is 77 level used for ?

Ans: Elementary level item. Cannot be subdivisions of other items (cannot be qualified), nor can they be subdivided themselves.

117. What is 88 level used for ?

Ans: For defining condition names.

118. What is level 66 used for ?

Ans: For RENAMES clause.

119. What does the IS NUMERIC clause establish?

Ans:IS NUMERIC can be used on alphanumeric items, signed numeric & packed decimal items and unsigned numeric & packed decimal items. IS NUMERIC returns TRUE if the item only consists of 0-9. However, if the item being tested is a signed item, then it may contain 0-9, + and - .

120. My program has an array defined to have 10 items. Due to a bug, I find that even if the program access the 11th item in this array, the program does not abend. What is wrong with it?

Ans: Must use compiler option SSRANGE if you want array bounds checking. Default is NOSSRANGE. 

No comments:

My Ad

.