
- COBOL - Home
- COBOL - Overview
- COBOL - Environment Setup
- COBOL - Program Structure
- COBOL - Basic Syntax
- COBOL - Data Types
- COBOL - Basic Verbs
- COBOL - Data Layout
- COBOL - Conditional Statements
- COBOL - Loop Statements
- COBOL - String Handling
- COBOL - Table Processing
- COBOL - File Handling
- COBOL - File Organization
- COBOL - File Access Mode
- COBOL - File Handling Verbs
- COBOL - Subroutines
- COBOL - Internal Sort
- COBOL - Database Interface
COBOL Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to COBOL Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Q 1 - Which of the following file opening mode is invalid in COBOL?
Answer : A
Explanation
Valid file opening modes in COBOL are INPUT, OUTPUT, I-O, and EXTEND. APPEND file mode is not available in COBOL.
Answer : D
Explanation
Rewrite verb is used to update the records. File should be opened in I-O mode for rewrite operations. It can be used only after a successful Read operation. Rewrite verb overwrites the last record read.
Q 3 - Which of the following statement will give you Tutorials in TutorialsPoint string?
Answer : A
Explanation
In STRING(A,B), A is the staring position and B id the number of digits to select.
Q 4 - What is the output of following program?
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-NUM1 PIC X(4) VALUE '15AB'. PROCEDURE DIVISION. MOVE 'XXXX' TO WS-NUM1 DISPLAY WS-NUM1. STOP RUN.
Answer : B
Explanation
Value of WS-NUM1 will be displayed. While declaring the WS-NUM1 variable we have set the value as '15AB' but in the procedure division we have moved 'XXXX' value in WS-NUM1. So XXXX value is displayed.
You can try same code using Try it option available below:
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-NUM1 PIC X(4) VALUE '15AB'. PROCEDURE DIVISION. MOVE 'XXXX' TO WS-NUM1 DISPLAY WS-NUM1. STOP RUN.
Q 5 - What is the output of following program?
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-DESCRIPTION. 05 WS-NUM. 10 WS-NUM1 PIC 9(2) VALUE 20. 10 WS-NUM2 PIC 9(2) VALUE 56. 05 WS-CHAR. 10 WS-CHAR1 PIC X(2) VALUE 'AA'. 10 WS-CHAR2 PIC X(2) VALUE 'BB'. 10 WS-RENAME RENAMES WS-NUM2 THRU WS-CHAR2. PROCEDURE DIVISION. DISPLAY "WS-RENAME : " WS-RENAME. STOP RUN.
Answer : B
Explanation
This program will give compilation error as Renames should be defined at 66 level number.
You can try same code using Try it option available below:
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-DESCRIPTION. 05 WS-NUM. 10 WS-NUM1 PIC 9(2) VALUE 20. 10 WS-NUM2 PIC 9(2) VALUE 56. 05 WS-CHAR. 10 WS-CHAR1 PIC X(2) VALUE 'AA'. 10 WS-CHAR2 PIC X(2) VALUE 'BB'. 10 WS-RENAME RENAMES WS-NUM2 THRU WS-CHAR2. PROCEDURE DIVISION. DISPLAY "WS-RENAME : " WS-RENAME. STOP RUN.
Q 6 - Set statement is used to change the index value. Set verb is used to initialize, increment or decrement the index value. Is this statement true or false?
Answer : B
Explanation
This statement is true and it is used with Search and Search All to locate elements in table.
Q 7 - Rewrite verb is used to update the records. File should be opened in I-O mode for rewrite operations. It can be used even if read operation is not successful. Is this statement true or false?
Answer : B
Explanation
This statement is incorrect as the read operation should be successful before doing rewrite operation..
Q 8 - In which usage, data item is stored in pack decimal format and each digit occupies half a byte (1 nibble) and the sign is stored at the right most nibble?
Answer : B
Explanation
This statement is self explanatory.
Q 9 - Which statement we should not use in called program?
Answer : C
Explanation
We should not use Stop Run in called program as the calling program is expecting the control back. Stop run will end the execution and will return the control back to operating system.
Answer : D
Explanation
COMP-2 takes 8 bytes of storage.