- COBOL Tutorial
- 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 Useful Resources
- COBOL - Questions and Answers
- COBOL - Quick Guide
- COBOL - Useful Resources
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 - What is the mode in which you will OPEN a file for writing?
Answer : C
Explanation
To write into a file, the file has to be opened in either OUTPUT or EXTEND mode.
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.
Answer : B
Explanation
10.9- is invalid because sign can not be mentioned on the right.
Q 4 - Which of the following word cannot be a user-defined COBOL word?
Answer : B
Explanation
ACCEPT cannot be a user defined COBOL word as we cannot use COBOL reserved words.
Q 5 - What is the output of following program?
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-DESCRIPTION. 05 WS-DATE1 VALUE '20140831'. 10 WS-YEAR PIC X(4). 10 WS-MONTH PIC X(2). 10 WS-DATE PIC X(2). 05 WS-DATE2 REDEFINES WS-DATE1 PIC 9(8). PROCEDURE DIVISION. DISPLAY WS-DATE2. STOP RUN.
Answer : B
Explanation
When we redefine WS-DATE1 to WS-DATE2, automatically values from WS-DATE1 will be moved to WS-DATE2.
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-DATE1 VALUE '20140831'. 10 WS-YEAR PIC X(4). 10 WS-MONTH PIC X(2). 10 WS-DATE PIC X(2). 05 WS-DATE2 REDEFINES WS-DATE1 PIC 9(8). PROCEDURE DIVISION. DISPLAY WS-DATE2. STOP RUN.
Q 6 - What is the output of following program?
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-A PIC 9 VALUE 2. PROCEDURE DIVISION. A-PARA. DISPLAY 'A' GO TO B-PARA. B-PARA. DISPLAY 'B'. GO TO C-PARA D-PARA DEPENDING ON WS-A. C-PARA. DISPLAY 'C'. D-PARA. DISPLAY 'D'. STOP RUN.
Answer : B
Explanation
This is to show how control goes from one GOTO statement to other. Go step by step you will understand the flow. From B-para control will go to D-para as value in WS-A is 2, so it will go to the 2nd para which is mentioned in the GOTO statement.
You can try same code using Try it option available below:
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-A PIC 9 VALUE 2. PROCEDURE DIVISION. A-PARA. DISPLAY 'A' GO TO B-PARA. B-PARA. DISPLAY 'B'. GO TO C-PARA D-PARA DEPENDING ON WS-A. C-PARA. DISPLAY 'C'. D-PARA. DISPLAY 'D'. STOP RUN.
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 - Which option is used in Inspect verb to replace the string characters?
Answer : C
Explanation
Replacing option is used to replace the string characters.
Q 9 - In which division we write logic of the program?
Answer : A
Explanation
Procedure division is used to include the logic of the program. It consists of executable statements using variables defined in the data division. In this division, paragraph and section names are user-defined.
Answer : D
Explanation
(9+1)/2 = 5 bytes.