- 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 of the following file opening mode is invalid in COBOL?
Answer : A
Explanation
Valid file opening modes in COBOL are INPUT, OUTPUT, I-O, and EXTEND. APPEND file mode is not available in COBOL.
Answer : B
Explanation
Yes we can define a X(10) to X(20) as Redefines causes both fields to start at the same location, but it is not a good coding practice.
Q 3 - In which division, Linkage Section comes?
Answer : C
Explanation
Linkage section comes under data division which is used in called program.
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-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 - What is the output of following program?
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-CNT PIC 9(2) VALUE 0. 01 WS-STRING PIC X(15) VALUE 'AABCDACDAAEAAAF'. PROCEDURE DIVISION. INSPECT WS-STRING TALLYING WS-CNT FOR ALL 'A'. DISPLAY WS-CNT STOP RUN.
Answer : C
Explanation
Inspect statement will count the number of 'A' in the string and will put the value in WS-CNT.
You can try same code using Try it option available below:
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-CNT PIC 9(2) VALUE 0. 01 WS-STRING PIC X(15) VALUE 'AABCDACDAAEAAAF'. PROCEDURE DIVISION. INSPECT WS-STRING TALLYING WS-CNT FOR ALL 'A'. DISPLAY WS-CNT STOP RUN.
Q 7 - How records are stored & accessed in sequential file organization?
Answer : B
Explanation
A sequential file consists of records that are stored and accessed in sequential order.
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 - In which division we declare our variables?
Answer : C
Explanation
In Data Division we declare all the working storage variables.
Q 10 - Elementary items cannot be divided further. Level number, Data name, Picture clause and Value clause (optional) are used to describe an elementary item. State whether true or false?
Answer : A
Explanation
This statement is correct.
To Continue Learning Please Login
Login with Google