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

Identification division contains entries that is used to identify the program. This is the the first division and only mandatory division.

Q 2 - If 436 value is moved to a PP999 PIC clause, then what is edited value taken?

A - .00436

B - 00436

C - 436

D - 43600

Answer : A

Explanation

P is assumed decimal scaling position which is used to specify the location of an assumed decimal point when the point is not within the number that appears in the data item. .PIC PP999 means that numeric data item is of 3 characters and there are 5 positions after the decimal point.

Q 3 - What is the position of Area A in COBOL program?

A - 1-6 Columns

B - 8-11 Columns

C - 12-72 Columns

D - 72-80 Columns

Answer : B

Explanation

Area A starts from 8 to 11 column. All COBOL divisions, sections, paragraphs and some special entries must begin in Area A.

Q 4 - Which level number we should use for conditions?

A - 77

B - 88

C - 01

D - 66

Answer : B

Explanation

88 level number is used for defining condition name entries.

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 10.
   01 WS-NUMB PIC 9(9) VALUE 10.
   01 WS-NUMC PIC 9(9) VALUE 10.
   01 WS-NUMD PIC 9(9) VALUE 100.
   01 WS-NUME PIC 9(9) VALUE 10.

PROCEDURE DIVISION.
   SUBTRACT WS-NUMA WS-NUMB WS-NUMC FROM WS-NUMD GIVING WS-NUME.
   DISPLAY WS-NUME.

STOP RUN.

A - 000000100

B - 000000090

C - 000000070

D - 000000080

Answer : C

Explanation

The formula will be like (WS-NUME = WS-NUMD - WS-NUMA - WS-NUMB - WS-NUMC).

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 10.
   01 WS-NUMB PIC 9(9) VALUE 10.
   01 WS-NUMC PIC 9(9) VALUE 10.
   01 WS-NUMD PIC 9(9) VALUE 100.
   01 WS-NUME PIC 9(9) VALUE 10.

PROCEDURE DIVISION.
   SUBTRACT WS-NUMA WS-NUMB WS-NUMC FROM WS-NUMD GIVING WS-NUME.
   DISPLAY WS-NUME.

STOP RUN.

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 relative file organization?

A - Relative address

B - Sequentially

C - Directly

D - Both B & C

Answer : A

Explanation

A relative file consists of records ordered by their relative address.

Q 8 - Which of the following is not a figurative constant?

A - High-Values

B - Comma

C - Zero

D - Spaces

Answer : B

Explanation

Comma is not a figurative constant. Figurative constants are constant values.

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 S9(7)V99 COMP-3?

A - 10

B - 9

C - 4

D - 5

Answer : D

Explanation

(9+1)/2 = 5 bytes.

cobol_questions_answers.htm
Advertisements