- 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 - 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 - If 436 value is moved to a PP999 PIC clause, then what is edited value taken?
Answer : A
Explanation
P is assumed decimal scaling position which is used to specify the location of an assumed decimal point when the point is not within the number that appears in the data item. .PIC PP999 means that numeric data item is of 3 characters and there are 5 positions after the decimal point.
Q 3 - Which of the alphanumeric literal is invalid?
Answer : D
Explanation
'COBOL12" is invalid because inverted commas should be in pair and should be of same type.
Answer : B
Explanation
88 level number is used for defining condition name entries.
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) VALUE 10 . 01 WS-NUM2 PIC 9(9) VALUE 10. 01 WS-NUM3 PIC 9(9) VALUE 10. 01 WS-NUMA PIC 9(9) VALUE 50. 01 WS-NUMB PIC 9(9) VALUE 10. 01 WS-NUMC PIC 9(3). PROCEDURE DIVISION. COMPUTE WS-NUMC= (WS-NUM1 * WS-NUM2) - (WS-NUMA / WS-NUMB) + WS-NUM3. DISPLAY WS-NUMC STOP RUN.
Answer : B
Explanation
This is simple example to show the use of Compute statement.
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) VALUE 10 . 01 WS-NUM2 PIC 9(9) VALUE 10. 01 WS-NUM3 PIC 9(9) VALUE 10. 01 WS-NUMA PIC 9(9) VALUE 50. 01 WS-NUMB PIC 9(9) VALUE 10. 01 WS-NUMC PIC 9(3). PROCEDURE DIVISION. COMPUTE WS-NUMC= (WS-NUM1 * WS-NUM2) - (WS-NUMA / WS-NUMB) + WS-NUM3. DISPLAY WS-NUMC STOP RUN.
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 - 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 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 - Which division provides information of external data sets used in the program?
Answer : D
Explanation
In file control paragraph inside Environment division we mention all the information of external data sets used in the program.
Answer : D
Explanation
COMP-2 takes 8 bytes of storage.
To Continue Learning Please Login
Login with Google