- 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.
Answer : C
Explanation
Length of PIC 9.999 is 5 as '.' takes 1 byte. So total 1 byte for '.' and 4 bytes for 9.
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.
Answer : B
Explanation
Moving a numeric field to alphabetic field is illegal in COBOL. It will throw error.
Answer : B
Explanation
S9(6) USAGE is COMP will take 4 bytes based on the following formula which is used to calculate when USAGE is COMP :
S9(n) USAGE is COMP
If 'n' = 1 to 4, it takes 2 bytes.
If 'n' = 5 to 9, it takes 4 bytes.
If 'n' = 10 to 18, it takes 8 bytes.
Q 6 - What is the output of following program?
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-TABLE.
05 WS-A PIC A VALUE 'A' OCCURS 5 TIMES.
PROCEDURE DIVISION.
DISPLAY WS-TABLE.
STOP RUN.
Answer : B
Explanation
We are displaying the complete table so all the 5 occurrences will come 'AAAAA'.
You can try same code using Try it option available below:
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-TABLE.
05 WS-A PIC A VALUE 'A' OCCURS 5 TIMES.
PROCEDURE DIVISION.
DISPLAY WS-TABLE.
STOP RUN.
Q 7 - If the values of variables in the called program are modified, then their new values will reflect in the calling program. What type of call is this?
Answer : B
Explanation
The new values will reflect in the calling program when we use call by reference.
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 - Two or more identically sequenced files are combined using Merge statement. State whether true or false?
Answer : A
Explanation
This statement is correct.
Answer : D
Explanation
If 'n' = 1 to 4, it takes 2 bytes.
If 'n' = 5 to 9, it takes 4 bytes.
If 'n' = 10 to 18, it takes 8 bytes
