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

All COBOL statements must begin in area B which starts from 12 to 72 columns

Q 2 - Which cobol verb is used for updating a file?

A - READ

B - WRITE

C - UPDATE

D - REWRITE

Answer : D

Explanation

Rewrite verb is used to update the records. File should be opened in I-O mode for rewrite operations. It can be used only after a successful Read operation. Rewrite verb overwrites the last record read.

Q 3 - Which of the alphanumeric literal is invalid?

A - 'COBOL12'

B - "COBOL12"

C - "COBOL''12"

D - 'COBOL12"

Answer : D

Explanation

'COBOL12" is invalid because inverted commas should be in pair and should be of same type.

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

A - Relative address method

B - Sequential access method

C - Direct access method

D - Both B & C

Answer : D

Explanation

An indexed sequential file consists of records that can be accessed sequentially. Direct access is also possible.

Q 8 - Which verb is used to count or replace the characters in a string?

A - Count

B - Inspect

C - Replace

D - Add

Answer : B

Explanation

Inspect verb is used to count or replace the characters in a string. String operations can be performed on alphanumeric, numeric, or alphabetic values. Inspect operations are performed from left to right.

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