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 77 level used for?

A - Renames

B - Redefine

C - Group Item

D - Elementary Level

Answer : D

Explanation

77 level is an elementary level item which cannot be subdivided.

Q 2 - Under which section we should make an entry in the program for a SORT file?

A - FD

B - SD

C - MD

D - None of these

Answer : B

Explanation

For sorting a file, we should make an SD entry in File Section.

Q 3 - Which of the following statement will give you ‘Tutorials’ in TutorialsPoint string?

A - TutorialsPoint(1:9)

B - TutorialsPoint(9)

C - TutorialsPoint(9:1)

D - TutorialsPoint(9:9)

Answer : A

Explanation

In STRING(A,B), A is the staring position and B id the number of digits to select.

Q 4 - What is the output of following program?

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.

DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 WS-NUM1 PIC X(4) VALUE '15AB'.
   
PROCEDURE DIVISION.
   MOVE 'XXXX' TO WS-NUM1
   DISPLAY WS-NUM1.
STOP RUN.

A - 15AB

B - XXXX

C - Compilation error

D - Run time error

Answer : B

Explanation

Value of WS-NUM1 will be displayed. While declaring the WS-NUM1 variable we have set the value as '15AB' but in the procedure division we have moved 'XXXX' value in WS-NUM1. So XXXX value is displayed.

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 X(4) VALUE '15AB'.
   
PROCEDURE DIVISION.
   MOVE 'XXXX' TO WS-NUM1
   DISPLAY WS-NUM1.
STOP RUN.

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 100.
   01 WS-NUMB PIC 9(9) VALUE 15.
   01 WS-NUMC PIC 9(2).
   01 WS-REM PIC 9(2). 

PROCEDURE DIVISION.
   DIVIDE WS-NUMA BY WS-NUMB GIVING WS-NUMC REMAINDER WS-REM.
   DISPLAY WS-NUMC ', ' WS-REM
   
STOP RUN.

A - 06, 10

B - 10, 06

C - Error

D - 100, 15

Answer : A

Explanation

Formula will be like WS-NUMC = NUMA/NUMB and remainder will be stored in WS-REM.

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 100.
   01 WS-NUMB PIC 9(9) VALUE 15.
   01 WS-NUMC PIC 9(2).
   01 WS-REM PIC 9(2). 

PROCEDURE DIVISION.
   DIVIDE WS-NUMA BY WS-NUMB GIVING WS-NUMC REMAINDER WS-REM.
   DISPLAY WS-NUMC ', ' WS-REM
   
STOP RUN.

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 - How records are stored & accessed in sequential file organization?

A - Relative address method

B - Sequential access method

C - Direct access method

D - Both B & C

Answer : B

Explanation

A sequential file consists of records that are stored and accessed in sequential order.

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

01-07 are reserved for line numbers.

Q 10 - Sign condition is used to check the sign of a numeric operand. It determines whether a given numeric value is greater than, less than, or equal to ZERO. State whether true or false?

A - False

B - True

Answer : B

Explanation

This statement is correct.

cobol_questions_answers.htm
Advertisements