- 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
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 will happen if you code GO BACK instead of STOP RUN in a stand alone COBOL program?
A - Program will give run time error.
B - Program will go in infinite loop.
Answer : B
Explanation
A Stop run ends the unit of work and returns control to the operating system whereas GOBACK returns control to calling program. So if we code GO BACK instead of Stop Run, it will go in infinite loop.
Q 2 - Which utility is used for compiling COBOL program?
Answer : B
Explanation
IGCRCTL utility is used to compile a COBOL program.
Q 3 - What is the position of Area B in COBOL program?
Answer : C
Explanation
Area B start from 12 to 72 column. All COBOL statements must begin in area B.
Q 4 - What is the output of following program?
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-ID PIC 9(5). PROCEDURE DIVISION. A000-FIRST-PARA. INITIALIZE WS-ID REPLACING NUMERIC DATA BY 12345. DISPLAY WS-ID. STOP RUN.
Answer : B
Explanation
WS-ID will be initialized and numeric data will be replaced by 12345 as mentioned in the statement.
You can try same code using Try it option available below:
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-ID PIC 9(5). PROCEDURE DIVISION. A000-FIRST-PARA. INITIALIZE WS-ID REPLACING NUMERIC DATA BY 12345. DISPLAY WS-ID. STOP RUN.
Q 5 - What is the output of following program?
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-NUM PIC 9(3). 88 PASS VALUES ARE 041 THRU 100. 88 FAIL VALUES ARE 000 THRU 40. PROCEDURE DIVISION. A000-FIRST-PARA. MOVE 65 TO WS-NUM. IF PASS DISPLAY 'Passed with ' WS-NUM ' marks'. IF FAIL DISPLAY 'FAILED with ' WS-NUM 'marks'. STOP RUN.
Answer : B
Explanation
WS-NUM contains 65 so PASS condition is satisfied as values lies in range of 041 to 100.
You can try same code using Try it option available below:
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-NUM PIC 9(3). 88 PASS VALUES ARE 041 THRU 100. 88 FAIL VALUES ARE 000 THRU 40. PROCEDURE DIVISION. A000-FIRST-PARA. MOVE 65 TO WS-NUM. IF PASS DISPLAY 'Passed with ' WS-NUM ' marks'. IF FAIL DISPLAY 'FAILED with ' WS-NUM 'marks'. 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 - Write verb is used to insert records in a file. Once the record is written, it is no longer available in the record buffer. Is this statement true or false?
Answer : B
Explanation
This statement is correct.
Q 8 - Which of the following is not a figurative constant?
Answer : B
Explanation
Comma is not a figurative constant. Figurative constants are constant values.
Q 9 - What is the output of following program?
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-STRING PIC A(30) VALUE 'WELCOME TO TUTORIALSPOINT'. 01 WS-STR1 PIC A(7). 01 WS-STR2 PIC A(2). 01 WS-STR3 PIC A(15). 01 WS-COUNT PIC 99 VALUE 1. PROCEDURE DIVISION. UNSTRING WS-STRING DELIMITED BY SPACE INTO WS-STR1, WS-STR2, WS-STR3 END-UNSTRING. DISPLAY WS-STR2. STOP RUN.
Answer : B
Explanation
Unstring verb is used to split one string into multiple sub-strings.
You can try same code using Try it option available below:
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-STRING PIC A(30) VALUE 'WELCOME TO TUTORIALSPOINT'. 01 WS-STR1 PIC A(7). 01 WS-STR2 PIC A(2). 01 WS-STR3 PIC A(15). 01 WS-COUNT PIC 99 VALUE 1. PROCEDURE DIVISION. UNSTRING WS-STRING DELIMITED BY SPACE INTO WS-STR1, WS-STR2, WS-STR3 END-UNSTRING. DISPLAY WS-STR2. STOP RUN.
Answer : D
Explanation
(9+1)/2 = 5 bytes.
To Continue Learning Please Login
Login with Google