- 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 Mock Test
This section presents you various set of Mock Tests related to COBOL Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
COBOL Mock Test IV
Q 1 - In which usage, data item is similar to Real or Float and is represented as a single precision floating point number and internally data is stored in hexadecimal format?
Answer : D
Explanation
COMP-1 is represented as a single precision floating point number and data is internally stored in hexadecimal format.
Q 2 - 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 3 - 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 4 - Which verb is used to count or replace the characters in a string?
Answer : B
Explanation
Inspect verb is used to count or replace the characters in a string. String operations can be performed on alphanumeric, numeric, or alphabetic values. Inspect operations are performed from left to right.
Q 5 - 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 6 - What is the output of following program?
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-STRING PIC A(30). 01 WS-STR1 PIC A(15) VALUE 'Tutorialspoint'. 01 WS-STR2 PIC A(7) VALUE 'Welcome'. 01 WS-STR3 PIC A(7) VALUE 'To AND'. 01 WS-COUNT PIC 99 VALUE 1. PROCEDURE DIVISION. STRING WS-STR2 DELIMITED BY SIZE WS-STR3 DELIMITED BY SPACE WS-STR1 DELIMITED BY SIZE INTO WS-STRING WITH POINTER WS-COUNT ON OVERFLOW DISPLAY 'OVERFLOW!' END-STRING. DISPLAY 'WS-STRING : 'WS-STRING. STOP RUN.
Answer : B
Explanation
String command is used to concatenate the strings.
You can try same code using Try it option available below:
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-STRING PIC A(30). 01 WS-STR1 PIC A(15) VALUE 'Tutorialspoint'. 01 WS-STR2 PIC A(7) VALUE 'Welcome'. 01 WS-STR3 PIC A(7) VALUE 'To AND'. 01 WS-COUNT PIC 99 VALUE 1. PROCEDURE DIVISION. STRING WS-STR2 DELIMITED BY SIZE WS-STR3 DELIMITED BY SPACE WS-STR1 DELIMITED BY SIZE INTO WS-STRING WITH POINTER WS-COUNT ON OVERFLOW DISPLAY 'OVERFLOW!' END-STRING. DISPLAY 'WS-STRING : 'WS-STRING. STOP RUN.
Q 7 - What is the output of following program?
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-STRING PIC A(30) VALUE 'WELCOME TO TUTORIALSPOINT'. 01 WS-STR1 PIC A(7). 01 WS-STR2 PIC A(2). 01 WS-STR3 PIC A(15). 01 WS-COUNT PIC 99 VALUE 1. PROCEDURE DIVISION. UNSTRING WS-STRING DELIMITED BY SPACE INTO WS-STR1, WS-STR2, WS-STR3 END-UNSTRING. DISPLAY WS-STR2. STOP RUN.
Answer : B
Explanation
Unstring verb is used to split one string into multiple sub-strings.
You can try same code using Try it option available below:
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-STRING PIC A(30) VALUE 'WELCOME TO TUTORIALSPOINT'. 01 WS-STR1 PIC A(7). 01 WS-STR2 PIC A(2). 01 WS-STR3 PIC A(15). 01 WS-COUNT PIC 99 VALUE 1. PROCEDURE DIVISION. UNSTRING WS-STRING DELIMITED BY SPACE INTO WS-STR1, WS-STR2, WS-STR3 END-UNSTRING. DISPLAY WS-STR2. STOP RUN.
Q 8 - Which statement we should not use in called program?
Answer : C
Explanation
We should not use Stop Run in called program as the calling program is expecting the control back. Stop run will end the execution and will return the control back to operating system.
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 - In which division we declare our variables?
Answer : C
Explanation
In Data Division we declare all the working storage variables.
Q 11 - 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.
Q 12 - 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 13 - In which mode you will open the sequential file to append the data in the end.
Answer : D
Explanation
Sequential file is opened in Extend mode to append the data at the end. If you will open the file in Output mode it will delete all the existing data and then write the data.
Q 14 - Where does Column numbers in COBOL start from?
Answer : A
Explanation
01-07 are reserved for line numbers.
Q 15 - Where does Identification Area in COBOL starts from?
Answer : D
Explanation
Identification area is used as needed by the programmer.
Answer : D
Explanation
COMP-1 takes 4 bytes of storage.
Answer : D
Explanation
COMP-2 takes 8 bytes of storage.
Answer : D
Explanation
(9+1)/2 = 5 bytes.
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
Answer : D
Explanation
It will take 4 bytes, V is Implicit decimal & will not hold any byte.
Q 21 - 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.
Q 22 - Group items consist of one or more elementary items. Level number, Data name, and Value clause (optional) are used to describe a group item. Group level number is always 01. State whether true or false?
Answer : B
Explanation
This statement is true.
Q 23 - Decimal point position can be used with numeric data. Assumed position is the position of decimal point and not included in the data. State whether true or false?
Answer : B
Explanation
This statement is correct.
Q 24 - 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.
Q 25 - 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.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | D |
2 | C |
3 | B |
4 | B |
5 | C |
6 | B |
7 | B |
8 | C |
9 | A |
10 | C |
11 | D |
12 | A |
13 | D |
14 | A |
15 | D |
16 | D |
17 | D |
18 | D |
19 | D |
20 | D |
21 | A |
22 | B |
23 | B |
24 | B |
25 | B |