COBOL INTERVIEW QUESTIONS-3
- Which one of the following is true with respect to the record key clause.
A) The data name in this clause must be defined within the record description entry of the associated index file but can belong to any class-numeric, alphanumeric or alphabetic.
B) The data name in this must be defined as an alphanumeric data item within the record description entry of the associated indexed file
C) The data name in this clause must be defined as a numeric field outside the record description of the associated indexed file
D) The data name in this clause must be defined as an alphanumeric field outside the record description of the associated indexed file
- Which of the following is false about indexed files?
A) The organization is indexed clause must be present
B) The record key clause must be present
C) File status clause must be present
D) The access mode clause must be specified if random or dynamic access is required
- Which statement out of the following is similar to seek statement as far as functionality is concerned?
- Which of the following statements is not allowed when a relative file is opened in I-O mode and the access mode is random?
- Which of the following is not a procedure division verb?
- Which of the following is false about the actual parameter that will be passed to the subprogram
A) Actual parameters appear in the using phrase of call statement
B) In the using phrase of call statement, same data name can appear more than once
C) An actual parameter should be a data name described at level or 77
D) An actual parameter must be a data name in any section of the data division except the file section
- Which of the following is incorrect?
A) CALL SUB-PGM USING PARM-1 UNTIL PARM-1>10
B) CALL SUB-PGM
C) CALL SUB-PGM ON OVERFLOW GO TO MISSING-SUB
D) CALL SUB-PGM USING PARM-1
- A COBOL developer has an option to set up special error
processing procedures to precede or follow system-defined
procedures for handling input/output errors. This can be accomplished using
A) INVALID KEY option
B) ON SIZE ERROR option
C) USE option
D) REWRITE option
- The minimal set of clauses that are needed in COBOL 85 to set and Initialize a table of constant values in WORKING-STORAGE section
B) VALUE, OCCURS
C) VALUE, OCCURS, REDEFINES
D) VALUE, OCCURS, REDEFINES, INDEXED BY
- Consider the following FILE SECTION and select the
most appropriate comment from the four given below:
05 CALENDAR-DATE PIC X(6).
10 CALENDAR-DD PIC 99.
10 CALENDAR-MM PIC 99.
10 CALENDAR-YY PIC 99.
A) The specifications are correct
B) Incorrect, as level 10 declarations specify all numeric digits whereas the level 5 declaration for the corresponding group item specifies alphanumeric characters
C) Incorrect, since PIC is not a correct keyword
D) Incorrect, since PIC clause cannot be specified for a group item
- The function of the SYNC clause is to ensure that
A) The data-name begins or/and ends at a word boundary for word oriented computers
B) The record begins or/and ends at a word boundary for word oriented computers
C) The record always starts at a / boundary for disk files
D) The data-name assumes binary and not DISPLAY number representation.
- While the following statement is executed
READ IN-FILE AT END PERFORM CLOSE-UP
When the AT END path is taken?
A) The last record is being read and the current READ encounters the EOF
B) All the records have been read and the current READ encounters the EOF
C) The program execution is about to terminate; AT END is a declaration specifying terminal processing and has nothing to do with the READ statement in which it appears
D) The statement is incorrect since AT END should be followed by GO TO
- State True/False?
'A paragraph name may consist of only numeric digits.'
- State True/False?
The symbol V in a PIC clause stands for a decimal point between two consecutive digits and is counted for in the field size
B) False (No it is not counted for)
- State True/False?
A file description entry may have several record descriptions Entries associated with it.'
- Two data-names VAR1 and VAR2 have 9(5) and ZZ,ZZ9 for their PIC specifications. VAR1 at one point contains the value 48 and the statement
MOVE VAR1 TO VAR2
will result in the following value for VAR2
D) None of the above (where bbb means blank spaces)
- The data-name VAR1 has the following FILE section entry:
05 VAR1 PIC X(25).
The result of the statement
MOVE SPACE TO VAR1 would be to
A) Move spaces to all the bytes of VAR1
B) Move a single space to the first byte of VAR1 leaving the others unchanged
C) Move single space to the last byte of VAR1 leaving the others unchanged
D) None of the above, this will result in a compile-time error
- Data-names VAR1, VAR2, VAR3 and VAR4 have the following
definitions in the WORKING-STORAGE section:
01 VAR1 PIC 9-.
01 VAR2 PIC 9+.
01 VAR3 PIC 9CR.
01 VAR4 PIC 9DB.
- The statement MOVE -8 to VAR1, VAR2, VAR3, VAR4 will produce the following bytes in VAR1, VAR2, VAR3 and VAR4 respectively.
A) 8b 8- 8CR 8bb
B) 8- 8- 8bb 8DB
C) 8- 8- 8CR 8DB
D) 8- 8b 8DB 8CR
E) None of the above
- Three data-names var1, var2 and var3 have the following WORKING-STORAGE data descriptions:
01 var1 PIC 99V999.
01 var2 PIC 9(4)V999.
01 var3 PIC 9(4)V99.
If the following statement is executed with the values 10.261, 991.724 and 20.0 in var1, var2 and var3 respectively, the resulting what will be the value of var3
ADD var1, var2 GIVING var3 ROUNDED ON SIZE ERROR, MOVE ZERO TO VAR3
- If data-name VAR1 and VAR2 have their PIC specifications as 9(4)V99 and 9(4).99 respectively, the DIVIDE statement
DIVIDE VAR1 INTO VAR2 ROUNDED
will result in the following:
A) The rounded value of the quotient that results from dividing VAR1 by VAR2 replaces VAR1
B) The rounded value of the quotient that results from dividing VAR2 by VAR1 replaces VAR2.
C) A compile time error since VAR2 has an edit symbol in its PIC and compiler expects a numeric value.
D) An executtion-time error since VAR2 has an edit symbol in its PIC.