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

Q 1 - What is the maximum size of a numeric field we can define in COBOL?

A - 9(20)

B - 9(18)

C - 9(31)

D - 9(10)

Answer : B

Explanation

COBOL applications use 31 digit numeric fields. However, compiler only supports a maximum of 18 digits. So we use a maximum of 18 digits.

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.

Q 3 - Which of the alphanumeric literal is invalid?

A - 'COBOL12'

B - "COBOL12"

C - "COBOL''12"

D - 'COBOL12"

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.

A - 00000

B - 12345

C - Spaces

D - Compilation error

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 - How many bytes S9(6) USAGE IS COMP will take?

A - 6

B - 4

C - 3

D - 2

Answer : B

Explanation

S9(6) USAGE is COMP will take 4 bytes based on the following formula which is used to calculate when USAGE is COMP :
S9(n) USAGE is COMP
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.

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.

A - A

B - AAAAA

C - Spaces

D - Error

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?

A - Relative address method

B - Sequential access method

C - Direct access method

D - Both B & C

Answer : D

Explanation

An indexed sequential file consists of records that can be accessed sequentially. Direct access is also possible.

Q 8 - Dynamic Call occurs when a program is compiled with the DYNAM and NODLL compiler option. A dynamic called program is loaded into storage at runtime. Is this statement true or false?

A - False

B - True

Answer : B

Explanation

This statement is correct.

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 999V9?

A - 6

B - 5

C - 3

D - 4

Answer : D

Explanation

It will take 4 bytes, V is Implicit decimal & will not hold any byte.

cobol_questions_answers.htm
Advertisements