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 will happen if you code GO BACK instead of STOP RUN in a stand alone COBOL program?

A - Program will give run time error.

B - Program will go in infinite loop.

C - Program will execute normally.

D - Program will throw compilation error.

Answer : B

Explanation

A Stop run ends the unit of work and returns control to the operating system whereas GOBACK returns control to calling program. So if we code GO BACK instead of Stop Run, it will go in infinite loop.

Q 2 - Which utility is used for compiling COBOL program?

A - IKJEFT01

B - IGYCRCTL

C - IGYCTCRL

D - None of these

Answer : B

Explanation

IGCRCTL utility is used to compile a COBOL program.

Answer : C

Explanation

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

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

A - Yes

B - No

Answer : A

Explanation

Moving a numeric field to alphanumeric is legal in COBOL.

Q 5 - What is the output of following program?

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.

DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 WS-NUM PIC 9(3).
   88 PASS VALUES ARE 041 THRU 100.
   88 FAIL VALUES ARE 000 THRU 40.

PROCEDURE DIVISION.
   A000-FIRST-PARA.
   MOVE 65 TO WS-NUM.
   
   IF PASS 
      DISPLAY 'Passed with ' WS-NUM ' marks'.
      
   IF FAIL 
      DISPLAY 'FAILED with ' WS-NUM 'marks'.
      
STOP RUN.

A - Compilation error

B - Passed with 065 marks

C - FAILED with 065 marks

D - None of these

Answer : B

Explanation

WS-NUM contains 65 so PASS condition is satisfied as values lies in range of 041 to 100.

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

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.

DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 WS-NUM PIC 9(3).
   88 PASS VALUES ARE 041 THRU 100.
   88 FAIL VALUES ARE 000 THRU 40.

PROCEDURE DIVISION.
   A000-FIRST-PARA.
   MOVE 65 TO WS-NUM.
   
   IF PASS 
      DISPLAY 'Passed with ' WS-NUM ' marks'.
      
   IF FAIL 
      DISPLAY 'FAILED with ' WS-NUM 'marks'.
      
STOP RUN.

Q 6 - Search is a binary search method, which is used to find elements inside the table. Is this statement true or false?

A - True

B - False

Answer : B

Explanation

This statement is false as Search is a linear search method where as Search All is binary search method.

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

Answer : A

Explanation

Procedure division is used to include the logic of the program. It consists of executable statements using variables defined in the data division. In this division, paragraph and section names are user-defined.

Q 10 - Decimal point position can be used with numeric data. Assumed position is the position of decimal point and not included in the data. State whether true or false?

A - False

B - True

Answer : B

Explanation

This statement is correct.


cobol_questions_answers.htm

Advertisements