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.

Questions and Answers

Answer : B

Explanation

All COBOL statements must begin in area B which starts from 12 to 72 columns

Q 2 - Which utility is used for compiling COBOL program?

A - IKJEFT01

B - IGYCRCTL

C - IGYCTCRL

D - None of these

Answer : B

Explanation

IGCRCTL utility is used to compile a COBOL program.

Answer : B

Explanation

Search All is a binary search method, which is used to find elements inside the table.

Q 4 - Moving a Alphabetic field to Numeric is legal?

A - Yes

B - No

Answer : B

Explanation

Moving a alphabetic field to numeric field is illegal in COBOL. It will throw error.

Q 5 - How many bytes S9(6) USAGE IS COMP-3 will take?

A - 6

B - 3

C - 4

D - 7

Answer : B

Explanation

S9(6) USAGE is COMP-3 will take 3 bytes based on the following formula which is used to calculate when USAGE is COMP-3 :
S9(n) USAGE is COMP-3
Number of bytes = n/2 (If n is even)
Number of bytes = n/2 + 1(If n is odd, consider only integer part)

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.

A - 09

B - 06

C - 08

D - 10

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 - If the values of variables in the called program are modified, then their new values will not reflect in the calling program. What type of call is this?

A - Call by content

B - Call by reference

C - None of these

Answer : A

Explanation

The new values will not reflect in the calling program when we use call by content.

Q 8 - 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?

A - COMP

B - COMP-3

C - COMP-2

D - COMP-1

Answer : D

Explanation

COMP-1 is represented as a single precision floating point number and data is internally stored in hexadecimal format.

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 - What is the length of PIC S9(7) COMP?

A - 7

B - 6

C - 5

D - 4

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

cobol_questions_answers.htm
Advertisements