COBOL Online Quiz


Advertisements


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 - 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.

Answer : C

Explanation

Linkage section comes under data division which is used in called program.

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.

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 - What is the output of following program?

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.

DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 WS-TABLE.
      05 WS-A OCCURS 3 TIMES.
         10 WS-B PIC A(2).
         10 WS-C OCCURS 2 TIMES.
            15 WS-D PIC X(3).

PROCEDURE DIVISION.
   MOVE '12ABCDEF34GHIJKL56MNOPQR' TO WS-TABLE.
   DISPLAY 'WS-C(3,1) : ' WS-C(3,1).
   
STOP RUN.

A - DEF

B - ABC

C - PQR

D - MNO

Answer : D

Explanation

It is a 2-D array and we are using subscript to the access the elements in the table. WS-C(3,1) has MNO value in it.ws

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 OCCURS 3 TIMES.
         10 WS-B PIC A(2).
         10 WS-C OCCURS 2 TIMES.
            15 WS-D PIC X(3).

PROCEDURE DIVISION.
   MOVE '12ABCDEF34GHIJKL56MNOPQR' TO WS-TABLE.
   DISPLAY 'WS-C(3,1) : ' WS-C(3,1).
   
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 - Which verb is used to count or replace the characters in a string?

A - Count

B - Inspect

C - Replace

D - Add

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 9 - Two or more identically sequenced files are combined using Merge statement. State whether true or false?

A - True

B - False

Answer : A

Explanation

This statement is correct.

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

A - False

B - True

Answer : B

Explanation

This statement is correct.


cobol_questions_answers.htm

Advertisements