- 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 is the mandatory division in COBOL program?
Answer : B
Explanation
Identification division contains entries that is used to identify the program. This is the the first division and only mandatory division.
Q 2 - Under which section we should make an entry in the program for a SORT file?
Answer : B
Explanation
For sorting a file, we should make an SD entry in File Section.
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 the following code?
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-NUM1 PIC 9(9). 01 WS-NUM2 PIC 9(6). PROCEDURE DIVISION. A000-FIRST-PARA. MOVE 123456789 TO WS-NUM1. MOVE WS-NUM1(3:6) TO WS-NUM2. DISPLAY WS-NUM2 STOP RUN.
Answer : D
Explanation
WS-NUM1(3:6) indicates that select from 3rd column & up to 6 digits. So result will 345678.
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 9(9). 01 WS-NUM2 PIC 9(6). PROCEDURE DIVISION. A000-FIRST-PARA. MOVE 123456789 TO WS-NUM1. MOVE WS-NUM1(3:6) TO WS-NUM2. DISPLAY WS-NUM2 STOP RUN.
Q 5 - What is the output of following program?
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-NUM1 PIC 9(9).
01 WS-NUM2 PIC 9(9).
PROCEDURE DIVISION.
A000-FIRST-PARA.
MOVE 25 TO WS-NUM1
MOVE 15 TO WS-NUM2
IF WS-NUM1 > WS-NUM2 THEN
DISPLAY 'IN LOOP 1 - IF BLOCK'
ELSE
DISPLAY 'IN LOOP 1 - ELSE BLOCK'
END-IF.
STOP RUN.
Answer : B
Explanation
WS-NUM1 is greater than WS-NUM2, so condition is satisfied and it will to IF loop.
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 9(9).
01 WS-NUM2 PIC 9(9).
PROCEDURE DIVISION.
A000-FIRST-PARA.
MOVE 25 TO WS-NUM1
MOVE 15 TO WS-NUM2
IF WS-NUM1 > WS-NUM2 THEN
DISPLAY 'IN LOOP 1 - IF BLOCK'
ELSE
DISPLAY 'IN LOOP 1 - ELSE BLOCK'
END-IF.
STOP RUN.
Q 6 - Physical record is the information that exists on the external device and Logical record is the information which is used by the program. Is this statement true or false?
Answer : A
Explanation
This statement is correct.
Q 7 - How records are stored & accessed in indexed file organization?
Answer : D
Explanation
An indexed sequential file consists of records that can be accessed sequentially. Direct access is also possible.
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 - Two or more identically sequenced files are combined using Merge statement. State whether true or false?
Answer : A
Explanation
This statement is correct.
Q 10 - Sign condition is used to check the sign of a numeric operand. It determines whether a given numeric value is greater than, less than, or equal to ZERO. State whether true or false?
Answer : B
Explanation
This statement is correct.
