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 - How is sign stored in a COMP-3 field?

A - First Bit

B - Last Bit

C - First Nibble

D - Last Nibble

Answer : D

Explanation

In COMP-3 field, sign is stored in last nibble.

Q 2 - Which cobol verb is used for updating a file?

A - READ

B - WRITE

C - UPDATE

D - REWRITE

Answer : D

Explanation

Rewrite verb is used to update the records. File should be opened in I-O mode for rewrite operations. It can be used only after a successful Read operation. Rewrite verb overwrites the last record read.

Answer : B

Explanation

Coding asterisk (*) at 7th column comments out the complete line in COBOL program.

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

A - Yes

B - No

Answer : A

Explanation

Moving a numeric field to alphanumeric is legal in COBOL.

Q 5 - What is the output of following program?

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.

PROCEDURE DIVISION.
   A-PARA.
   PERFORM DISPLAY 'A'
   END-PERFORM.
   PERFORM C-PARA THRU E-PARA.
   
   B-PARA.
   DISPLAY 'B'.
   STOP RUN.
   
   C-PARA.
   DISPLAY 'C'.
   
   D-PARA.
   DISPLAY 'D'.
   
   E-PARA.
   DISPLAY 'E'.

A - ACDEB

B - ADCEB

C - DEBAC

D - DACEB

Answer : A

Explanation

This is to show how control goes from one Perform statement to other. Go step by step you will understand the flow.

You can try same code using Try it option available below:

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.

PROCEDURE DIVISION.
   A-PARA.
   PERFORM DISPLAY 'A'
   END-PERFORM.
   PERFORM C-PARA THRU E-PARA.
   
   B-PARA.
   DISPLAY 'B'.
   STOP RUN.
   
   C-PARA.
   DISPLAY 'C'.
   
   D-PARA.
   DISPLAY 'D'.
   
   E-PARA.
   DISPLAY 'E'.

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?

A - False

B - True

Answer : B

Explanation

This statement is true and it is used with Search and Search All to locate elements in table.

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 Long or Double and is represented as double precision floating point number and internally data is stored in hexadecimal format?

A - COMP

B - COMP-3

C - COMP-2

D - COMP-1

Answer : C

Explanation

COMP-2 is represented as double precision floating point number and internally data is stored in hexadecimal format.

Q 9 - Which division provides information of external data sets used in the program?

A - PROCEDURE DIVISION.

B - IDENTIFICATION DIVISION

C - DATA DIVISION

D - ENVIRONMENT DIVISION

Answer : D

Explanation

In file control paragraph inside Environment division we mention all the information of external data sets used in the program.

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