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

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

Q 2 - Can I redefine an X(10) field with a field of X(20)?

A - No

B - Yes

Answer : B

Explanation

Yes we can define a X(10) to X(20) as Redefines causes both fields to start at the same location, but it is not a good coding practice.

Answer : B

Explanation

Coding asterisk (*) at 7th column comments out the complete line in COBOL program.

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 - How many bytes S9(6) USAGE IS COMP will take?

A - 6

B - 4

C - 3

D - 2

Answer : B

Explanation

S9(6) USAGE is COMP will take 4 bytes based on the following formula which is used to calculate when USAGE is COMP :
S9(n) USAGE is COMP
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.

Q 6 - What is the output of following program?

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.

DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 WS-STRING PIC X(15) VALUE 'ABCDACDADEAAAFF'.

PROCEDURE DIVISION.
   INSPECT WS-STRING REPLACING ALL 'A' BY 'X'.
   DISPLAY WS-STRING.
   
STOP RUN.

A - ABCDACDADEAAAFF

B - XBCDXCDXDEXXXFF

C - Compilation error

D - Run time error

Answer : B

Explanation

Replacing command will replace all the 'A' by 'X'.

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

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.

DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 WS-STRING PIC X(15) VALUE 'ABCDACDADEAAAFF'.

PROCEDURE DIVISION.
   INSPECT WS-STRING REPLACING ALL 'A' BY 'X'.
   DISPLAY WS-STRING.
   
STOP RUN.

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

A - Call by content

B - Call by reference

C - None of these

Answer : A

Explanation

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

Q 8 - Which option is used in Inspect verb to replace the string characters?

A - Count

B - Tallying

C - Replacing

D - Add

Answer : C

Explanation

Replacing option is used to replace the string characters.

Q 9 - In which mode you will open the sequential file to append the data in the end.

A - APPEND

B - INPUT

C - OUTPUT

D - EXTEND

Answer : D

Explanation

Sequential file is opened in Extend mode to append the data at the end. If you will open the file in Output mode it will delete all the existing data and then write the data.

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
E-Books Store