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

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 - How many times following loop will execute?

MOVE 5 TO X.
PERFORM X TIMES.
MOVE 10 TO X.
END-PERFORM.

A - 11

B - 5

C - 10

D - 15

Answer : B

Explanation

PERFORM loop will execute for 5 times. As it reads the first statement PERFORM 5 times. It replaces X with the value 5.

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

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.

DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 X PIC 99.

PROCEDURE DIVISION.
   MOVE 5 TO X.
   PERFORM X TIMES
   MOVE 10 TO X
   DISPLAY 'COUNT'
   END-PERFORM.
   STOP RUN.

Answer : C

Explanation

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

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

A - Yes

B - No

Answer : B

Explanation

Moving a alphabetic field to numeric field is illegal in COBOL. It will throw error.

Q 5 - How many bytes S9(6) USAGE IS COMP-3 will take?

A - 6

B - 3

C - 4

D - 7

Answer : B

Explanation

S9(6) USAGE is COMP-3 will take 3 bytes based on the following formula which is used to calculate when USAGE is COMP-3 :
S9(n) USAGE is COMP-3
Number of bytes = n/2 (If n is even)
Number of bytes = n/2 + 1(If n is odd, consider only integer part)

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 - For deleting a record, in which mode we should open the file?

A - Input-Output

B - Input

C - Output

D - Extend

Answer : A

Explanation

Delete verb can be performed only on indexed and relative files. The file must be opened in I-O mode. In sequential file organization, records cannot be deleted. The record last read by the Read statement is deleted in case of sequential access mode. In random access mode, specify the record key and then perform the Delete operation.

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 - 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 - What is the length of PIC S9(7) COMP?

A - 7

B - 6

C - 5

D - 4

Answer : D

Explanation

If 'n' = 1 to 4, it takes 2 bytes.
If 'n' = 5 to 9, it takes 4 bytes.
If 'n' = 10 to 18, it takes 8 bytes


cobol_questions_answers.htm

Advertisements