Download as pdf or txt
Download as pdf or txt
You are on page 1of 30

1. John is calling PGM2 from PGM1 using Cobol Call verb.

Help him to choose the right


verb totransfer the control from PGM2 to PGM1
a) STOP RUN
b) EXIT PROGRAM
c) RETURN
d) STOP PROGRAM

2. For the below table how do you assign value 1 to the


index x?01 STUDENT.
02 STUDENT-DETAILS OCCURS 100 TIMES INDEXED BY X
03 NAME PIC X(20).
03 MARKS PIC 9(02).
a) MOVE 1 TO X
b) SET X TO 1
c) SET 1 TO X
d) ADD 1 TO X

3. Jack is creating a Cobol program to read last 10 records of KSDS file. The KSDS file has 20
recordsHelp Jack to choose the correct file operations and steps to perform above operation.
Note: The access mode of programs is Dynamic.
a) Execute the READ in loop
b) Excute the START command and then execute READ NEXT RECORD in loop
c) Execute the START command and then execute READ in loop
d) Execute the START command in loop

4. John is creating two cobol programs called PAYROLL and HR. He wants to send some
payrolldata from PAYROLL to HR program. Which section he should code to receive the
data in HR program sent by PAYROLL program?
a) FILE SECTION
b) LINKAGE SECTION
c) INPUT-OUTPUT SECTION
d) WORKING-STORAGE SECTION

5. How do you access the second customer’s name from the below Cobol Table using subscript?
01 WS-CUST-RECORD.
05 WS-CUST-TABLE OCCURS 3 TIMES.
10 WS-CUSTID PIC 9(5).
10 WS-CUSTNAME PIC A(10).
a) WS-CUST-TABLE(2)
b) WS-CUSTNAME(2)
c) WS-CUSTNAME(1)
d) WS-CUST-TABLE(1)

6. David is working on COBOL assignment and planning to write a program to update the
customerdetails as per the assignment. Here, in which mode, David has to open the file?
a) INPUT
b) I-O
c) EXTEND
d) OUTPUT

7. Sample input data:


CNO CNAME CADD

C0001 MOHIT INDIA

C0002 DAVID USA

C0003 SMITHA UK

C0001 JOHN INDIA

C0003 KAMAL USA

Assume that we are trying to write the above records into KSDS. How many records will be
written into KSDS if CNO is primary key?

a) 2
b) 3
c) 4
d) 5

8. Which access mode will allow to perform random as well as sequential operations on a KSDS?
a) Sequential
b) Random
c) Dynamic
d) Indexed

9. A KSDS file contains following data in it.


ENO ENAME EADD

111 DAVID INDIA

222 SMITHA USA


333 JOHN INDIA

Assume ENO is a primary key, EMPFILE as logical file name.


Identify the appropriate code to delete one record(222 emp no) from KSDS file.
a) MOVE 222 TO ENO
DELETE EMPFILE ENO
b) MOVE 222 TO ENO
DELETE EMPFILE RECORD
c) DELETE RECORD EMPFILE
d) DELETE ENO EMPFILE

10. If SEARCH all must be applied on the below table, what is


missing?01 WS-CUST-TABLE-RECORD.
05 WS-CUST-TABLE OCCURS 3 TIMES.
10 WS-CUSTID PIC 9(5).
10 WS-CUSTNAME PIC A (10)
a) table must be indexed
b) table must be sorted on a particular field
c) SEARCH ALL can still be applied, there is no issue with field
d) table must be indexed and sorted on a particular field

11. Mary is trying to read only one record using primary key from KSDS . In this scenario,
what isappropriate access mode she should use?
a) ACCESS MODE IS SEQUENTIAL
b) ACCESS MODE IS DYNAMIC
c) ACCESS MODE IS ONLY
d) ACCESS MODE IS RAANDOM

12. In which order all below 3 sections will be coded in data division of a Cobol
program?1)WORKING-STORAGE SECTION
2) FILE SECTION
3) LINKAGE SECTION
a) Above sections can be coded in any order
b) LINKAGE SECTION-> WORKING-STORAGE SECTION-> FILE SECTION
c) WORKING-STORAGE SECTION-> LINKAGE SECTION-> FILE SECTION
d) FILE SECTION-> WORKING-STORAGE SECTION-> LINKAGE SECTION

13. Consider the below Cobol Code


CALL ‘PGM123’ USING WS-NUM1 WS-NUM2 WS-NUM3.
What is the name of above 3 variables used in a CALL statements of Cobol program?
a) Actual Parameters
b) Formal Parameters
c) Symbolic Parameters
d) Data Members

14. DATA
DIVISION.
FILE
SECTION. FD
CFILE.
01 FS-CREC.
05 FS-CNO PIC 9(5).
05 FS-CNAME PIC A(15).
05 FS-CADD PIC X(15).
01 WS-FS1 PIC99.
PROCEDURE DIVISION.
MAIN-PARA.
OPEN INPUT CFILE
PERFORM 1000-READ-PARA UNTIL WS-FS1 = 10
CLOSE CFILE.
STOP RUN.
1000-READ-PARA
READ CFILE.
EVALUATE WS-FS1
WHEN 00
IF FS-CADD=’INDIA’
DISPLAY FS-CREC
END-IF
WHEN 10
…………………………………..
…………………………………..
a) 10003DEEPTHI INDIA
10001RAM INDIA
10005PRIYANKA INDIA
b) 10001RAM INDIA
10003DEEPTHI INDIA
10005PRIYANKA INDIA
END OF FILE
c) 10005PRIYANKA INDIA
10003DEEPTHI INDIA
10001RAM INDIA
END OF FILE
d) 10001RAM INDIA
10003DEEPTHI INDIA
10005PRIYANKA INDIA

15. CALL ES-PGM USING A B C


What is the meaning of above CALL STATEMENTS ?
a) It is static call and passing three arguments by reference
b) It is dynamic call and passing three arguments by reference
c) It is dynamic call and passing three arguments by content
d) Is is static call and passing three arguments by content

16. Geetha who is a new joiner in ABC Banking project is assigned a task to work on variable
lengthfile(TFILE). The following is the record structure of the VB file.
01 T-NEW-CREC.
05 TRANS-TYPE-N PIC 9(1).
05 TNCID PIC 9(4).
05 TNNAME PIC X(15).
05 TNADD PIC X(20).
05 TNDOB PIC X(10).
05 TNMOBILE PIC 9(10).
01 t-del-rec.
05 TRANS-TYPE-D PIC 9(1).
05 TDCID PIC 9(4).
Can you help Geetha in coding the correct FD statement for the VB file in the Cobol program?
a) FD TFILE
RECORD IS VARYING IN SIZE FROM 4 TO 64 CHARACTERS
b) FD TFILE
RECORD IS VARYING IN SIZE FROM 5 TO 60 CHARACTERS
c) FD TFILE
RECORD IS VARYING IN SIZE FROM 5 TO 74 CHARACTERS
d) FD TFILE
RECORD IS VARYING IN SIZE FROM 5 TO 70 CHARACTERS

17. What is appropriate file opening mode to append the data to an existing file?
a) INPUT
b) I-O
c) EXTEND
d) OUTPUT

18. What is true respect to CALL statements.


a) CALL BY REFERENCE is the default in COBOL.
b) CALLL BY VALUE is the default in COBOL.
c) LINKAGE SECTION must be coded in the calling program to send the values to the sub
program
d) PROCEDURE DIVISION USING statements must be coded in the calling program to send
values to sub program

19. Notify the incorrect lines of below


code100 IDENTIFICATION DIVISION
200 PROGRAM MOVE
300 ENVIROMENT DIVISION
400 INPUT OUTPUT SECTION
500 FILE SECTION
a) 100
b) 400
c) 100 & 400
d) 200 & 500

20. Below in the COBOL code declaration of employee details KSDS dataset. Assume…………
ENVRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT EMPFILE ASSIGN TO EMP
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS FS-EMPNO
FILE STATUS IS WS-FS1.
DATA DIVISION
FILE SECTION
FD EMPFILE
01 FS-EMPREC
05 FS-EMPNO PIC 9(04).
05 FS-EMPNAME PIC A(10).
PROCEDURE DIVISION
OPEN I-O EMPFILE
MOVE 1004 TO FS-EMPNO
START EMPFILE KEY IS GRATER THAN FS-EMPNO
READ EMPFILE NEXT RECORDf
DISPLAY FS-EMPREC
CLOSE EMPFILE
STOP RUN
a) Will display the next record whose key is greater than 1004
b) Will display the record of employee id 1004.
c) Will display the first employee record
d) Will display the employee records from the KSDS.

21. John is writing a COBOL program to read all the records from sequential file for some processing
. in this scenario , which logic you suggest as per john’s requirement.
a) MAIN-PARA
PERFORM READ-PARA UNTIL FILE-STATUS-CODE = 10.
READ-PARA
READ FILENAME
IF FILE-STATUS-CODE = 00
PERFORM PROCES-PARA
END-IF.
b) MAIN-PARA
PERFORM READ-PARA 10 TIMES.
READ-PARA
READ FILENAME
PERFORM PROCES-PARA
c) MAIN-PARA
PERFORM READ-PARA UNTIL FILE-STATUS-CODE = 00.
READ-PARA
READ FILENAME
IF FILE-STATUS-CODE = 00
PERFORM PROCES-PARA
END-IF.
d) MAIN-PARA
PERFORM READ-PARA UNTIL FILE-STATUS-CODE = 10.
READ-PARA
READ FILENAME
INVALID KEY
DISPLAY NO MORE RECORDS
NOT INVALID KEY
PERFORM PROCESS-PARA
END-READ.

22. Below is the COBOL decleration of employee details ps datset if the employee dataset already
two three employee records . what will be the output…

ENVRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT EMPFILE ASSIGN TO EMP
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS WS-FS1.
DATA DIVISION
FILE SECTION
FD EMPFILE
01 FS-EMPREC
05 FS-EMPNO PIC 9(04).
05 FS-EMPNAME PIC A(10).
05 FS-EMPLOC PIC A(10).
PROCEDURE DIVISION
OPEN OUTPUT EMPFILE
MOVE ‘1004DILIP BANGLORE’ TO FS-EMPREC
WRITE FS-EMPREC
CLOSE EMPFILE
STOP RUN
a) A new employee record will be added after the three records in the Employee dataset.
b) A new employee record will be added after deleting the old three records.
c) Write operation cannot be performed in the OUTPUT mode.
d) Compiliation error due ti invalid WRITE syntax . it must be WRITE EMPFILE.

23. If you using a KSDS file in your program , then in which of the following division and section
doyou declare the name of the file.
a) ENVIRONMENT DIVISION,INPUT-OUTPUT SECTION
b) DATA DIVISION,FILE SECTION
c) ENVIRONMENT DIVISION,FILE SECTION
d) PROCEDURE DIVISION,FILE SECTION

24. What will be default mode assumed by COBOL?


a) INPUT
b) OUTPUT
c) EXTEND
d) I-O
e) No default mode assumed by cobol. Amy has to explicitly menction the opening mode

25. Consider the following data and code frandam read


ENO ENAME EADD

111 DAVID INDIA

222 SMITHA USA


333 JOHN INDIA

Note: ENO is a primary key and the above data is existing in KSDS outset assume file successfully
opened by the program
MOVE 222 TO ENO
READ EMPFILE
NOT INVAILD KEY DISPLAY EMPLOYEE DATA ENO ENAME EADD
END-READ
What would the file status code if we run the above code snippet?
a) 00
b) 23
c) 10
d) 21

26. WRITE MY-REC INVALID KEY GO TO ERROR-PARA.


Select which of the following are not valid modes of opening the KSDS file for performing the
above operation.
A.INPUT
B.OUTPUT
C.I-O
a) Only A
b) Only B
c) Only C
d) B and C

27. Which of the following statements are true with respect to Subscript and index in Cobol
Tblehandling? (Select 2 correct options)
a) Subscript is defined along with the occurs clause and index Storage section
b) Subscript works slower when compared to index
c) Subscript represents occurrence of table, whereas index position in a table
d) Subscript can be incremented by using options like

28. If SEARCH ALL must be applied on the below table, what is


missing?01 WCUST-RECORD.
05 W-CUST-TABLE OCCURS 3 TIMES.
10 WS-CUSTID PIC 9(5).
10 WS-CUSTNAME PIC A(10).
a) Table must be indexed
b) Table must be sorted on a particular field
c) SEARCH ALL can still be applied; there is no issue with………..
d) Table must be indexed and sorted on a particular field

29. Jack is understanding different file status code of cobol program .help him to understand
themeaning of status code 10.
a) End of the file
b) Record not found
c) Duplicate record
d) File not found

30. John is using a sequential file to maintain the employee records PS file has few records. He
would to add few records through program. Help him to identify the mode in when file has
to beopen.
a) APPEND
b) INPUT
c) OUTPUT
d) EXTEND

31. Choose the name of statement is used to map logical file name in program and actual file
namein RUNJCL?
a) ORGANIZATION statement
b) ACCES MODE statement
c) SELECT statement
d) FILE STATUS statement

32. Which of the following is correct statements with respect to program and subprogram?
a) Calling programs must end with an EXIT PROGRAM entry
b) Called programs must end with an EXIT PROGRAM entry
c) The other name of calling program is sub program.
d) COPY and CALL verb do same operation in cobol.

33. Identify the appropriate opening mode for the indexed file(KSDS) that supports all file
I/Ooperations(READ/WRITE/DELETE/START/REWRITE).
a) INPUT
b) I-O
c) EXTEND
d) OUTPUT

34. What is appropriate file opening mode to append the data to an existing file?
a) INPUT
b) I-O
c) EXTEND
d) OUTPUT

35. What happens if we code STOP RUN verb in sub program?


a) Control will be transferred from main program to sub program
b) Control will be transferred from sub program to main program
c) Control will not transferred from sub program to main program
d) Control will not be transferred from main program to sub program

36. How do you define a table/array in COBOL using INDEX?


a) 01 WS-EMP
05 WS-EMP-DETAILS OCCURS 10 TIMES INDEXED BY X
10 WS-ENAME PIC X(30).
10 WS-EADD PIC X(30).
b) 01 WS-EMP
05 WS-EMP-DETAILS INDEXED BY X OCCURS 10 TIMES
10 WS-ENAME PIC X(30)
10 WS-EADD PIC X(30)
c) 01 WS-EMP INDEXED BY X OCCURS 10 TIMES
06 WS-EMP-DETAILS
10 WS-ENAME PIC X(30)
10 WS-EADD PIC X(30)
d) 01 WS-EMP OCCURS 10 TIMES INDEXED BY X
05 W-EMP-DETAILS
10 WS-ENAME PIC X(30)
10 ES-EADD PIC X(30)

37. Consider the following code


snippet.OPEN OUTPUT EMPFILE.
PERFORM 3 TIMES
READ EMPFILE
DISPLAY FS-EMPREC
END-PERFORM.
CLOSE EMPFILE.
Assume PS file EMPFILE has 10 records and also file successfully opened by the program. How
many records will be displayed after running the above program?
a) First 3 records will be displayed
b) Last 3 records will be displayed
c) No records will be displayed due to wrong the opening mode
d) All 10 records will be displayed

38. Consider the following cobol code


snippet.01 WS-TABLE.
05 DW-TABLE-ELEMENT OCCURS 5 TIMES PIC X(01) VALUE ‘A’.
………………
PROCEDURE DIVISION.
DISPLLAY WS-TABLE.
What will be the output of the above code snippest?
a) A
b) AAAAA
c) SPACES
d) None of the listed options

39. EXIT PROGRAM.


The above COBOL statements is valid in which of the following program?
A)Called Program
B) Calling Program
a) A only
b) Both A and B
c) B only
d) It is a invalid COBOL STATEMENTS

40. Which of the following perform statement is correct to display all the marks of first
semester.01 STUDENT.
05 STUDENT-SEMESTER OCCURS 3 TIMES
10 STUDENT-MARK PIC 9(3) OCCURS 5 TIMES.
01 WS-SEMESTER PIC 9.
01 WS-MARK PIC 9.
a) PERFORM DISP-PARA VARYING WS-SEMESTER FROM 1 BY 1 UNTIL WS-SEMESTER
>3 AFTER W-MARK FROM 1 BY 1 UNTIL WS-MARK>5
b) PERFORM DISP-PARA VARYING WS-SEMESTER FROM 1 BY 1 UNTIL WS-SEMESTER
>5 AFTER W-MARK FROM 1 BY 1 UNTIL WS-MARK>3
c) PERFORM DISP-PARA VARYING WS-SEMESTER FROM 0 BY 1 UNTIL WS-SEMESTER
>3 AFTER W-MARK FROM 0 BY 1 UNTIL WS-MARK>5
d) PERFORM DISP-PARA VARYING WS-SEMESTER FROM 0 BY 1 UNTIL WS-SEMESTER
>5 AFTER W-MARK FROM 0 BY 1 UNTIL WS-MARK>3

41. What is the output of the below code snippet? Assume there are no syntax
errors.OPEN INPUT INFILE.
READ INFILE.
READ INFILE.
DISPLAY FS-RECORD
CLOSE INFILE.
Assume the logical INFILE has 10 records already present and FS-RECORD is the name of the
Record buffer. Choose most appropriate option.
a) All the 10 records will be displayed
b) The last records will be displayed
c) No records will be displayed
d) The second record will be displayed

42. Identify the right statements from the given below about KSDS.
a) KSDS supports only RANDOM and DYNAMIC access mode
b) Opening mode for DELETE is I-O
c) Record key is not a mandatory statements in file controlpara of KSDS
d) Access mode RANDOM doesnot support START command
e) KSDS record key can be updated

43. Consider the below Cobol Code


PROCEDURE DIVISION USING LK-A LK-B LK-C
What is the name of above 3 variables used in a CALL statements of Cobol program?
a) Actual Parameters
b) Formal Parameters
c) Symbolic Parameters
d) Data Members

44. Choose the incorrect statements from the below with respect to STATIC and DYNAMIC Call
a) CALL ‘PGM1’ is considered as a STATIC CALL
b) CALL WS-PGM is considered as a DYNAMIC CALL
c) CALL ‘PGM1’ along with DYNAM compiler opction is considered as a DYNAMIC CALL
d) CALL ‘PGM1’ along with NODYNAM compiler opction is considered as a DYNAMIC CALL

45. Identify the cobol statement executed at compile time.


a) MOVE
b) COPY
c) CALL
d) PERFORM
46. CALL WS-PGM USING BY CONTENT NUM 1 NUM2
NUM3
What is the meaning of above CALL STATEMENTS ?
• It is static call and passing three arguments by reference
• It is dynamic call and passing three arguments by reference
• It is dynamic call and passing three arguments by content
• Is is static call and passing three arguments by content

47. How do you access the second customer’s complete (both custid and name together)
01 WS-CUST-RECORD.
05 WS-CUST-TABLE OCCURS 3 TIMES.
10 WS-CUSTID PIC 9(5).
10 WS-CUSTNAME PIC A(10).
• WS-CUST-TABLE(2)
• WS-CUSTNAME(2)
• WS-CUSTNAME(1)
• WS-CUST-TABLE(1)

48. Jack is coding a COBOL program to add new record to an existing PS dataset. If the new record must be
appended to previous records of the PS, what must be the opening mode of this PS ?
Choose most appropriate option.
• EXTEND
• INPUT
• OUTPUT
• I-O

49. What is the cobol statement to be coded in sub program to return control lo main program?
• EXIT PROGRAM
• RETURN
• STOP RUN
• STOP PROGRAM

50. Joe is going to perform file error handing using file status code where Joe has to define file status code in his
Cobol Program?
• FILE SECTION
• WORKING STORAGE SECTON
• LINKAGE SECTION
• PROCEDURE DIVISION
51. Choose a correct definition in file control para to read the data randomly from KSDS dataset?

• SELECT CFLE ASSIGN TO DD1


ORGANIZATION IS INDEXED
ACCESS MODE IS SEOUENTIAL
RECORD KEY IS FS-CNO KEY

• SELECT CFILE ASSIGN TO DD1


ORGANIZATION IS INDEXED
ACCESS MODE IS RANDOM
RECORD KEY IS FS-CNO-KEY

• SELECT CFILE ASSIGN TO DD1


ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS RANDOM
RECORD KEY IS FS-CNO.KEY

• SELECT CFILE ASSIGN TO DD1


ORGANIZATION IS RELATIVE
ACCESS MODE IS RANDOM
RECORD KEY IS FS-CNO-KEY

52. what would be the expected result of this program( Assuming the Ne has enough records with EDEPT as HR
and all the divisions are defined properly)
FD IN-FILE
01 IN-RECORD
05 ENAME PIC 9(14)
05 ELOC PIC X(10).
05 EDEPT PIC X(5).
WORKING-STORAGE SECTION
77 FS1 PIC 99.
77 WS-EOF PIC X VALUE 'N'
PROCEDURE DIVISION
PERFORM OPEN-FILES
PERFORM READ-PARA UNTIL WS-EOF = ‘Y’.
PERFORM CLOSE-FILES
PERFORM EXIT-PARA
OPEN-FILES. OPEN OUTPUT IN-FILE
READ-PARA
READ IN-FILE
AT END
• The program shall run successfully without updating any record
• The program shall update all the ‘HR’ dept records with ELOC as MUMBAI
• The program will throw run time error because of incorrect way of the handling
• The program shall update all the records in IN-FILE with ELOC as MUMBAI
53. Which COBOL verb is used for updating a data?
• READ
• WRITE
• UPDATE
• REWRITE

54. Mary is working on batch application and writing a pseudo code to read all the reords from ps file.in the
scenario what is the access mode mary ………….
• RANDOM
• DYNAMIC
• SEQUENTICAL
• LINER

55. JACK IS UNDERSTANDING DIFFERENT HIS STATUS CODE OF COBAL PROGRAM HELP HIM TO UNDERSTAND THE
MEANING OF THE STATUS CODE ?
• END OF THE FILE
• RECORD NOT FOUND
• DUPLICATE RECORD
• FILE NOT FOUND
56. Is it possible to delete a record from PS dataset via COBOL Program?
• Yes delete is possible in all access mode
• No
• Delete is possible in dynamic access mode
• Delete is possible in sequential access mode
57. Consider the below table deciation ?
01 WS-TABLE
05 WS-STUD-INFO OCCURS 10 TIMES
TO WS-STUD-ID PIC S9(9) COMP
TO WS-STUD-NAME PIC A(10)
What is the size of the above table? Choose most appropriate option
• 190 bytes
• 120 bytes
• 29 bytes
• 140 bytes

58. Which of the following about SEARCH ALL in Cobol Table handling is incorrect?
• The table must be sorted based on some field
• The table must have ASCENDING or DESCENDING KEY
• The table must be indexed
• The table must be subscripted
59. Amy Technical Lead in ABC Banking Project, would like the entire team to use the same Record layout for the
payroll file.
Instead of each member coding the record structure in their programs, can you suggest a best
possible way to use the record
structure which is stored in particular PDS and being used by all the team members ?
• There is no such way to share the record structure and is mandatory for team
membersb define the record structure in their programs
• Use IMPORT command in Cobol program working storage section) to use
the recordinput and pass the PDS DD name in the Run Jcl job
• Use COPY command in Cobol program (working storage section and
provide thecopybook name
• Use REUSE command in Cobol program (working-storage section) and record
structurebe reused in all the programs

60. What is the size of file status variable in bytes ?


• 2
• 3
• 4
• 5
61. 01 WS-STD-REC OCCURS 2 TIMES.
05 WS-SNO PIC 9(4).
05 WS-SNAME PIC X(10).
05 WS-SADD PIC X(18).
• Compilation error as OCCURS cause declared
• Runtime error as OCCURS clause declared
• Occur clause is invalid in COBOL
• MAXCC=0 during compilation and runtime

62. Below sample data stored in KSDS:


-----------------------------------------------
CNO CNAME CADD
---------------------------------------------
C0001 RAHUL INDIA
C0002 MANJU USA
C0003 DEEPIKA UK
C0007 MOHINI INDIA
C0008 KAMALA USA
Choose the valid code snippet to read C0003 key value record?
Note: FS-CNO, FS-CNAMEE and FS-CADD are the name of the name of the file variables FS-CNO is the primary
key
• MOVE ‘COO3’ TO FS-CNO
READ FILE
INVAILD KEY
DISPLAY RECORD NOT FOUND
NOT INVAILD
DISPLAY FS-CNO FS-CNAME FS-
END READ
____________
______________
__________D____
______________

• READ FILENAME
INVAILD KEY
DISPLAY_____
NOT INVALID KEY
DISPLAY

• MOVE ‘COO3’ TO FS-CND


READ FILE NAME
AT END
DISPLAY RECORD NOT FOUND
NOT AT END
DISPLAY FS-CNO FS-CNAME FS-
END READ

63. WORKING STORAGE SECTION.


01WS-FSI PIC99.
01 WS—COUNT PIC 9 VALUE 1.
PROCEDURE DIVISION.
OPEN I-O CFILE.
PERFORM 1000-READ-PARA UNTIL WS-FS1=10
CLOSE CFILE
AT END
DISPLAY ‘END OF THE FILE’
NOT AT END
IF WS-FS1=100
ADD 1 TO WS-COUNT
END IF
END-READ.

NOTE: Access mode of the file is sequential


Assume that below data is present in KSDS file
C0001 ROHIT INDIA 100000
C0002 DIVYA UK 20000
C0003 MOHIT UK 30000
C0004 ANKIT USA 40000
C0005
• 6
• 5
• 7
• 4
• Mcq-3-2 lo 7 page
• MCQ3-3 LO PAGE 6
2. What is the size of file status virable in bytes------------- > 2 bytes

1. The Linkage section must be used in following component to handle the data between the
programs------------------- > Called Program
2. What is false with respect to CALL statement?-------------------- > CALL BY CONTENT is the default
in COBOL
3. EXIT PROGRAM The above Cobol statement is valid in which of the following program? A)Called
Program B)Calling Program Choose the most appropriate option ------------------ >Only in A
4. CALL 'DEPOSIT' USING WS-ACCNO,WS-AMT. What is the meaning of above CALL statement?
Note: The above program is compiled with compiler option NODYNAM------ >It is a static call and
passing two arguments by reference.
5. How do you access the second employee's complete details (both empid and name together)?
01 WS-EMP-RECORD. 05 WS-EMP-TABLE OCCURS 10 TIMES. 10 WS-EMPID PIC 9(5). 10 WS-
EMPNAME PIC A(10) ---- > WS-EMP-TABLE(2)
6. How many divisions of Cobol are mandatory to code when you write a Cobol program for file
processing? --------------- > All 4 divisions are mandatory to code
7. James has written below cobol code snippet.He wants to guess what is the output of the code
snippet? Assume there are no syntax errors and also PS file has been successfully opened by the
program. Note : WS-FS is the file status variable of FILE1. OPEN INPUT FILE1. PERFORM UNTIL
WS-FS = 0 READ FILE1 END-PERFORM. CLOSE FILE1. STOP RUN. Assume PS file file1 has 5
records. Choose the most appropriate option-------------------> No record will be read
8. OPEN EXTEND FILE1. PERFORM 5 TIMES READ FILE1 DISPLAY FS-EMPREC END-PERFORM. CLOSE
FILE1. Assume PS File FILE1 has 10 records and also file successfully opened by the program.
How many records will be displayed after the running the above program?--------------- > No
records will be displayed due to wrong file opening mode
9. Remi is writing a COBOL program to read all the records from customer sequential file for
displaying it in spool. Customer PS file has 10 records In this scenario, which logic you suggest as
per John’s requirement.Choose 2 appropriate logic------------- > MAIN-PARA. PERFORM READ-
PARA UNTIL STATUS-CODE = 10. READ-PARA. READ CUSTFILE. IF STATUS-CODE = 00 PERFORM
DISPLAY-PARA END-IF.
----------------->MAIN-PARA. PERFORM READ-PARA 10 TIMES. READ-PARA. READ CUSTFILE.
PERFORM DISPLAY-PARA
10. Consider the following Cobol code: 01 WS-EOF-FLAG PIC X(1) VALUE ‘N’. 88 EOF-REACHED
VALUE ‘Y’. 88 EOF-NOT-REACHED VALUE ‘N’. PROCEDURE DIVISION. PERFORM READ-PARA
UNTIL EOF-REACHED. READ-PARA. READ EMPFILE ?????? NOT AT END PERFORM PROCESS-PARA
END-READ. Write the corresponding code in ?????? To stop the read operation when end of file
is reached --------------- →AT END MOVE ‘Y’ TO WS-EOF-FLAG
48. Question 1 (1 point)
49.
50. Saved
51. When we write record to a PS file, in which mode we
need to open the file?
Choose most appropriate option.
52. Question 1 options:
OUTPUT
INPUT
EXTEND

Either EXTEND or OUTPUT

53. Question 2 (1 point)


54.
55. Saved
56. Say True or False
57. Statement A: To perform rewrite operation file should
be opened in I-O mode.
58. Statement B: Even if the read operation is not
successful, rewrite operation is performed.
59. Question 2 options:
Both are true
Both are false
Statement A is true , B is false
Statement B is true, A is false

60. Question 3 (1 point)


61.
62. Saved
63. Identify the correct statement(s).
64. Question 3 options:
To perform read operation, READ statement specifies the filename
To perform write operation, WRITE statement specifies the filename
To perform read operation, READ statement specifies the record name
To perform write operation, WRITE statement specifies the record name

65. Question 4 (1 point)


66.
67. Saved
68. Choose the Cobol verb executed at compilation time.
69. Question 4 options:
COPY
READ
ACCEPT
DISPLAY

70. Question 5 (1 point)


71.
72. Saved
73. Which file status code indicates end of file is reached
in PS dataset.
74. Question 5 options:
20
00
15
10

75. Question 6 (1 point)


76.
77. Saved
78. SELECT statement is typed in which section of COBOL
program?
79. Question 6 options:
LINKAGE SECTION
FILE SECTION
INPUT-OUTPUT SECTION
LINKAGE SECTION

Question 1 (1 point)

Identify the incorrect lines of code below:

00100 IDENTIFICATION DIVISION.

00200 PROGRAM-ID. READ.

00300 ENVIRONMENT DIVISION.

00400 INPUT-OUTPUT SECTION.

00500 FILE SECTION.


Question 1 options:
00100
00400
00500
00200 and 00500
00200

Question 2 (1 point)

In which opening mode, the file operation START is supported in


KSDS file?
Question 2 options:
INPUT
I-O
OUTPUT
EXTEND

Question 3 (1 point)

Consider the following code snippet:

ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT EMP ASSIGN TO EMP
ORGANIZATION IS INDEXED
RECORD KEY IS F1.What will be the access mode decided by
the program for the file EMP?
Question 3 options:
Indexed
Sequential
Random
Dynamic

Question 4 (1 point)

Choose 3 mandatory statements must be written in file control


para for indexed file.
Question 4 options:
Select statement
Access Mode statement
Organization statement
Record Key statement

Question 5 (1 point)

Choose the 2 invalid verb for indexed file.


Question 5 options:
READ
SELECT
START
DELETE
UPDATE
WRITE

Question 6 (1 point)

What is the file status code for invaid key when you perform a
random read on a KSDS file?
Question 6 options:
35
23
22
10

Question 1 (1 point)

Consider the following COBOL code snippet:

WORKING-STORAGE SECTION.
01 WS-PGM PIC X(08) VALUE 'PGM2'.
PROCEDURE DIVISION.
MAIN-PARA.
CALL WS-PGM.
STOP RUN.

CALL statement in the above code is valid.State True or False.


Question 1 options:
True
False

Question 2 (1 point)

Which of the following are correct rules when using the CALL
statement?(Choose 2)
Question 2 options:
Sub programs must end either with Exit Program or Goback to pass the control back to calling program
Calling program and Called program should be written in same PDS
CALL statement executed at compilation time.
Each data-name in the USING phrase must be defined in the DATA DIVISION of the calling program
CALL statement can be coded either in DATA DIVISION or PROCEDURE DIVISION.

Question 3 (1 point)

Variables are referred in the CALL statement are called as Formal


Parameters.

State True or False

Question 3 options:
True
False

Question 4 (1 point)

Variable length file has more than one record structure. State
True or False.
Question 4 options:
True
False

Question 5 (1 point)

CALL 'SUBPGM' USING WS-NUM1 WS-NUM2.


This call statement is compiled using DYNAM compiler option.
This CALL is called as static call. State True or False.
Question 5 options:
True
False
Question 6 (1 point)

In static call the main program and all sub programs are bound
together before even they are executed. State True or False.
Question 6 options:
True
False

Question 1 (1 point)

A search on Table can be done with or without Index. State True


or False
Question 1 options:
True
False

Question 2 (1 point)

Consider below table declaration

01 WS-STUDENT.

05 WS-STUD-REC OCCURS 5 TIMES.

10 WS-STUD-ID PIC S9(4) COMP.

10 WS-STUD-NAME PIC A(10).

What is the size of variable WS-STUDENT in bytes?


Question 2 options:
19
60
70
17

Question 3 (1 point)

Which of the following about SEARCH ALL in Cobol Table


handling is incorrect?
Question 3 options:
The table must be sorted based on some field
The table must have ASCENDING or DESCENDING KEY
The table must be indexed
The table must be subscripted

Question 4 (1 point)

We cannot intialize the table. State True or False


Question 4 options:
True
False

Question 5 (1 point)

Check the following Code.

01 DETAILS VALUE '100101102011122'.

05 STUDENTINFO OCCURS 5 TIMES.

10 STUDNO PIC 9(03).


Above table declaration will give compile time error. State True
or False.

Question 5 options:
True
False

Question 6 (1 point)

How do you display the second student name alone in Spool


from the below table using subscript?

01 STUDENT.

05 STUDENT-INFO OCCURS 5 TIMES.

10 STUD-ID PIC 9(05).

10 STUD-NAME PIC A(10).

Question 6 options:
DISPLAY STUD-NAME(2).
DISPLAY STUDENT-INFO(2).
DISPLAY STUD-NAME(1).
DISPLAY STUDENT(2).

You might also like