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 - How you will declare a Half Word Binary in program?

A - S9(8) COMP

B - S9(4) COMP

C - 9(8) COMP

D - 9(4) COMP

Answer : B

Explanation

S9(4) COMP is used to declare a Half Word Binary.

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 RENAMES clause?

A - 77

B - 49

C - 66

D - 88

Answer : C

Explanation

66 level number is used for RENAMES.

Q 5 - What is the output of following program?

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.

DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 WS-NUM1 PIC 9(9) VALUE 10 .
   01 WS-NUM2 PIC 9(9) VALUE 10.
   01 WS-NUM3 PIC 9(9) VALUE 10.
   01 WS-NUMA PIC 9(9) VALUE 50.
   01 WS-NUMB PIC 9(9) VALUE 10.
   01 WS-NUMC PIC 9(3).

PROCEDURE DIVISION.
   COMPUTE WS-NUMC= (WS-NUM1 * WS-NUM2) - (WS-NUMA / WS-NUMB) + WS-NUM3.
   DISPLAY WS-NUMC

STOP RUN.

A - 100

B - 105

C - Compilation error

D - Run time error

Answer : B

Explanation

This is simple example to show the use of Compute statement.

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

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.

DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 WS-NUM1 PIC 9(9) VALUE 10 .
   01 WS-NUM2 PIC 9(9) VALUE 10.
   01 WS-NUM3 PIC 9(9) VALUE 10.
   01 WS-NUMA PIC 9(9) VALUE 50.
   01 WS-NUMB PIC 9(9) VALUE 10.
   01 WS-NUMC PIC 9(3).

PROCEDURE DIVISION.
   COMPUTE WS-NUMC= (WS-NUM1 * WS-NUM2) - (WS-NUMA / WS-NUMB) + WS-NUM3.
   DISPLAY WS-NUMC

STOP RUN.

Q 6 - With test before is the default condition and it indicates that the condition is checked before the execution of statements in a paragraph. Is this statement true or false?

A - False

B - True

Answer : B

Explanation

This statement is true as with test before is the default condition for Perform until statement.

Q 7 - If the values of variables in the called program are modified, then their new values will reflect in the calling program. What type of call is this?

A - Call by content

B - Call by reference

C - None of these

Answer : B

Explanation

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

Q 8 - If usage is display, data item is stored in ASCII format and each character will take 1 byte. It is default usage. State whether true or false?

A - False

B - True

Answer : B

Explanation

This statement is correct.

Q 9 - Which statement we should not use in called program?

A - Linkage Section

B - Procedure Division Using

C - Stop Run

D - Exit Program

Answer : C

Explanation

We should not use Stop Run in called program as the calling program is expecting the control back. Stop run will end the execution and will return the control back to operating system.

Q 10 - Elementary items cannot be divided further. Level number, Data name, Picture clause and Value clause (optional) are used to describe an elementary item. State whether true or false?

A - True

B - False

Answer : A

Explanation

This statement is correct.

cobol_questions_answers.htm
Advertisements