Professional Documents
Culture Documents
MCQ Final
MCQ Final
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
C0003 SMITHA UK
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
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
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
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
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
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
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
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
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
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
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?
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
• READ FILENAME
INVAILD KEY
DISPLAY_____
NOT INVALID KEY
DISPLAY
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
Question 1 (1 point)
Question 2 (1 point)
Question 3 (1 point)
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)
Question 5 (1 point)
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)
WORKING-STORAGE SECTION.
01 WS-PGM PIC X(08) VALUE 'PGM2'.
PROCEDURE DIVISION.
MAIN-PARA.
CALL WS-PGM.
STOP RUN.
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)
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)
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)
Question 2 (1 point)
01 WS-STUDENT.
Question 3 (1 point)
Question 4 (1 point)
Question 5 (1 point)
Question 5 options:
True
False
Question 6 (1 point)
01 STUDENT.
Question 6 options:
DISPLAY STUD-NAME(2).
DISPLAY STUDENT-INFO(2).
DISPLAY STUD-NAME(1).
DISPLAY STUDENT(2).