- 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.
Answer : D
Explanation
77 level is an elementary level item which cannot be subdivided.
Q 2 - How many times following loop will execute?
MOVE 5 TO X. PERFORM X TIMES. MOVE 10 TO X. END-PERFORM.
Answer : B
Explanation
PERFORM loop will execute for 5 times. As it reads the first statement PERFORM 5 times. It replaces X with the value 5.
You can try same code using Try it option available below:
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 X PIC 99. PROCEDURE DIVISION. MOVE 5 TO X. PERFORM X TIMES MOVE 10 TO X DISPLAY 'COUNT' END-PERFORM. STOP RUN.
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.
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-NUMA PIC 9(9) VALUE 100. 01 WS-NUMB PIC 9(9) VALUE 15. 01 WS-NUMC PIC 9(2). 01 WS-REM PIC 9(2). PROCEDURE DIVISION. DIVIDE WS-NUMA BY WS-NUMB GIVING WS-NUMC REMAINDER WS-REM. DISPLAY WS-NUMC ', ' WS-REM STOP RUN.
Answer : A
Explanation
Formula will be like WS-NUMC = NUMA/NUMB and remainder will be stored in WS-REM.
You can try same code using Try it option available below:
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-NUMA PIC 9(9) VALUE 100. 01 WS-NUMB PIC 9(9) VALUE 15. 01 WS-NUMC PIC 9(2). 01 WS-REM PIC 9(2). PROCEDURE DIVISION. DIVIDE WS-NUMA BY WS-NUMB GIVING WS-NUMC REMAINDER WS-REM. DISPLAY WS-NUMC ', ' WS-REM STOP RUN.
Q 6 - Set statement is used to change the index value. Set verb is used to initialize, increment or decrement the index value. Is this statement true or false?
Answer : B
Explanation
This statement is true and it is used with Search and Search All to locate elements in table.
Q 7 - Static Call occurs when a program is compiled with the NODYNAM compiler option. A static called program is loaded into storage at compile time. Is this statement true or false.
Answer : B
Explanation
This statement is correct.
Q 8 - In which usage, data item is similar to Long or Double and is represented as double precision floating point number and internally data is stored in hexadecimal format?
Answer : C
Explanation
COMP-2 is represented as double precision floating point number and internally data is stored in hexadecimal format.
Q 9 - In which division we write logic of the program?
Answer : A
Explanation
Procedure division is used to include the logic of the program. It consists of executable statements using variables defined in the data division. In this division, paragraph and section names are user-defined.
Q 10 - Class condition is used to check if an operand contains only alphabets or numeric data. Spaces are considered in ALPHABETIC, ALPHABETIC-LOWER, and ALPHABETIC-UPPER. State whether true or false?
Answer : B
Explanation
This statement is correct.
