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.
Q 1 - What is the mode in which you will OPEN a file for writing?
A -  OUTPUT
B -  EXTEND
C -  Either OUTPUT or EXTEND
D -  INPUT-OUTPUT
To write into a file, the file has to be opened in either OUTPUT or EXTEND mode.
Q 2 - Which utility is used for compiling COBOL program?
A - IKJEFT01
B - IGYCRCTL
C - IGYCTCRL
D - None of these
IGCRCTL utility is used to compile a COBOL program.
Q 3 - In which division, Input-Output section?
A - Identification Division
B - Environment Division
C - Data Division
D - Procedure Division
Input-Output section comes under Environment division which provides information about the files to be used in the program.
Q 4 - Moving a Alphabetic field to Numeric is legal?
A - Yes
B - No
Moving a alphabetic field to numeric field is illegal in COBOL. It will throw error.
Q 5 - What is the output of following program?
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.

DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 WS-DESCRIPTION.
   05 WS-DATE1 VALUE '20140831'.
   10 WS-YEAR PIC X(4).
   10 WS-MONTH PIC X(2).
   10 WS-DATE PIC X(2).
   05 WS-DATE2 REDEFINES WS-DATE1 PIC 9(8).

PROCEDURE DIVISION.
   DISPLAY WS-DATE2.

STOP RUN.
A - 00000000
B - 20140831
C - Compilation error
D - Run time error
When we redefine WS-DATE1 to WS-DATE2, automatically values from WS-DATE1 will be moved to WS-DATE2.
You can try same code using Try it option available below:
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.

DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 WS-DESCRIPTION.
   05 WS-DATE1 VALUE '20140831'.
   10 WS-YEAR PIC X(4).
   10 WS-MONTH PIC X(2).
   10 WS-DATE PIC X(2).
   05 WS-DATE2 REDEFINES WS-DATE1 PIC 9(8).

PROCEDURE DIVISION.
   DISPLAY WS-DATE2.

STOP RUN.
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
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 - Rewrite verb is used to update the records. File should be opened in I-O mode for rewrite operations. It can be used even if read operation is not successful. Is this statement true or false?
A - True
B - False
This statement is incorrect as the read operation should be successful before doing rewrite operation..
Q 8 - If usage clause is specified on a group, then all the elementary items will have the same usage clause. State whether true or false?
A - False
B - True
This statement is correct. 
Q 9 - In which division we declare our variables?
A - PROCEDURE DIVISION. 
B - IDENTIFICATION DIVISION 
C - DATA DIVISION 
D - ENVIRONMENT DIVISION 
In Data Division we declare all the working storage variables.
Q 10 - Group items consist of one or more elementary items. Level number, Data name, and Value clause (optional) are used to describe a group item. Group level number is always 01. State whether true or false?
A - False
B - True
This statement is true. 

    12 Lectures 
     2.5 hours 

 Nishant Malik

    33 Lectures 
     3.5 hours 

 Craig Kenneth Kaercher
 Print
 Add Notes
 Bookmark this page