Mainframe interview question and answers, Mainframe interview question with answers
Topic : COBOL Questions
1. Program name: P1.
Load library: TRGF99.COBOL.LOADLIB
Input File: TRGF99.FILE1
Output File: TRGF99.OUTFILE
//JOB1 JOB 124
//STEP01 EXEC PGM=P1
//STEPLIB DD DSN=TRGF99.COBOL.LOADLIB1,DISP=SHR
//INFILE DD DSN=TRGF99.FILE1,DISP=SHR
//OUTFILE DD DSN=TRGF99.OUTFILE,DISP=MOD
In the above scenario, if we execute this program which one of following errors we get?
Load library: TRGF99.COBOL.LOADLIB
Input File: TRGF99.FILE1
Output File: TRGF99.OUTFILE
//JOB1 JOB 124
//STEP01 EXEC PGM=P1
//STEPLIB DD DSN=TRGF99.COBOL.LOADLIB1,DISP=SHR
//INFILE DD DSN=TRGF99.FILE1,DISP=SHR
//OUTFILE DD DSN=TRGF99.OUTFILE,DISP=MOD
In the above scenario, if we execute this program which one of following errors we get?
a) S806 b)SE37 c)S0C4 d)S0C7
Answer is : a
---------------------------------------------------------------------------------------------------------------------
2. If ‘MAINPGM’ is COBOL program that calls another program ‘LINKPGM’ and passes a value say, ‘10’, that value will be accepted by another variable in link program. Where that variable is declared?
a) Working Storage Section of MAINPGM
b) Linkage Section of MAINPGM
c) Linkage Section of LINKPGM
d) Working Storage Section of LINKPGM
e) Both b & d
Answer : c
---------------------------------------------------------------------------------------------------------------------
3. A file attribute mismatch was encountered. What status code is related to above message?
a)35 b)39 c)46 d)90
ANSWER : a
-----------------------------------------------------------------------------------------------------------------------
4. Which one of the following divisions are mandatory
i) IDENTIFICATION
ii) ENVIRONMENT
iii) DATA
iv) PROCEDURE
a) i only b) i & ii c) iv only d) i & iv e) iii & iv
Answer : a)
--------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------
5. 01 WS-ABC PIC X.
88 FOUND VALUE ‘Y’.
88 NOT-FOUND VALUE ‘N’.
Whats the error in above code?
a) PIC clause is missing in the FOUND declaration.
b) PIC clause is missing in the NOT-FOUND declaration.
c) 88 level variables are declared in Area-A.
d) 01 level variable is declared in Area-A.
Answer : c
---------------------------------------------------------------------------------------------------------------------
6. Every file entry in File Control should have a description in the File Section.
a) True b) False
---------------------------------------------------------------------------------------------------------------------
6. Every file entry in File Control should have a description in the File Section.
a) True b) False
Answer : True
-----------------------------------------------------------------------------------------------------------------------
7. IF A>B
IF A>C
DISPLAY ‘A’
NEXT SENTENCE
END-IF
DISPLAY ‘C’
END-IF.
DISPLAY ‘B’.
If A=10, B=5, C=7. What is the output of above program?
-----------------------------------------------------------------------------------------------------------------------
7. IF A>B
IF A>C
DISPLAY ‘A’
NEXT SENTENCE
END-IF
DISPLAY ‘C’
END-IF.
DISPLAY ‘B’.
If A=10, B=5, C=7. What is the output of above program?
a) A C B b) A B c) B d) C B
Answer : B
------------------------------------------------------------------------------------------------------------------------
8. What is statement that is used to stop execution of the program?
------------------------------------------------------------------------------------------------------------------------
8. What is statement that is used to stop execution of the program?
a) GOBACK b) EXIT c) STOP RUN d) EXIT
Answer : c
-------------------------------------------------------------------------------------------------------------------------
9. MAIN-PARA
DISPLAY ‘IN MAIN-PARA’.
PERFORM PARA1 THRU PARA2.
STOP RUN.
PARA1.
DISPLAY ‘IN PARA1’.
PARA3.
DISPLAY ‘IN PARA3’.
PARA2.
DISPLAY ‘IN PARA2’.
Assume that above code is in PROCEDURE DIVISION of a COBOL program. If the above program is executed, what is the output?
a) IN MAIN-PARA b) IN MAIN-PARA c) IN MAIN-PARA
IN PARA1 IN PARA1 IN PARA1
IN PARA2 IN PARA3 IN PARA2
IN PARA2 IN PARA3
d) Compilation Error as Para-names are not declared in a proper order.
-------------------------------------------------------------------------------------------------------------------------
9. MAIN-PARA
DISPLAY ‘IN MAIN-PARA’.
PERFORM PARA1 THRU PARA2.
STOP RUN.
PARA1.
DISPLAY ‘IN PARA1’.
PARA3.
DISPLAY ‘IN PARA3’.
PARA2.
DISPLAY ‘IN PARA2’.
Assume that above code is in PROCEDURE DIVISION of a COBOL program. If the above program is executed, what is the output?
a) IN MAIN-PARA b) IN MAIN-PARA c) IN MAIN-PARA
IN PARA1 IN PARA1 IN PARA1
IN PARA2 IN PARA3 IN PARA2
IN PARA2 IN PARA3
d) Compilation Error as Para-names are not declared in a proper order.
Answer B
-----------------------------------------------------------------------------------------------------------------------
10. Can we move a variable containing Alphanumeric value to a variable containing Numeric value Yes or No ?
a) Yes b) No
-----------------------------------------------------------------------------------------------------------------------
10. Can we move a variable containing Alphanumeric value to a variable containing Numeric value Yes or No ?
a) Yes b) No
Answer : No
----------------------------------------------------------------------------------------------------------------------
11. How many bytes are required to the store data internally for variable defined as PIC 9(7)V99 USAGE COMP-3.
a) 4 b) 5 c) 6 d) 9
----------------------------------------------------------------------------------------------------------------------
11. How many bytes are required to the store data internally for variable defined as PIC 9(7)V99 USAGE COMP-3.
a) 4 b) 5 c) 6 d) 9
Answer B
----------------------------------------------------------------------------------------------------------------------
12. Find number of bytes which will be stored in variable EMP-RECORD
01 EMP-RECORD.
02 EMP-DATA1.
03 EMP-NAME PIC X(10).
03 EMP-SAL PIC 9(04).
02 EMP-DATA2 REDEFINES EMP-DATA1.
03 EMP-N1 PIC X(12).
03 EMP-N2 PIC 9(02).
02 EMP-DATA3.
03 DEPT1 PIC X(02).
03 DEPT2 PIC X(02).
a) 14 b) 16 c) 18 d) 32
----------------------------------------------------------------------------------------------------------------------
12. Find number of bytes which will be stored in variable EMP-RECORD
01 EMP-RECORD.
02 EMP-DATA1.
03 EMP-NAME PIC X(10).
03 EMP-SAL PIC 9(04).
02 EMP-DATA2 REDEFINES EMP-DATA1.
03 EMP-N1 PIC X(12).
03 EMP-N2 PIC 9(02).
02 EMP-DATA3.
03 DEPT1 PIC X(02).
03 DEPT2 PIC X(02).
a) 14 b) 16 c) 18 d) 32
Answer : c
----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------
13. A PIC 9(2)V9(3) VALUE 10.121
B PIC 9(2) VALUE 12
C PIC 9(2)V99 VALUE 11.23
What will be
value in C after following statement is executed
ADD A, B GIVING C ROUNDED
a) 22.121 b) 22.12 c) 22.13 d) 11.23
ADD A, B GIVING C ROUNDED
a) 22.121 b) 22.12 c) 22.13 d) 11.23
Answer : B
ConversionConversion EmoticonEmoticon