[vc_row][vc_column css_animation=”fadeInLeft”][vc_column_text css=”.vc_custom_1563535552882{background-color: #1e73be !important;}”]

 COBOL Interview Questions & Answers

[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column css_animation=”fadeInLeft” width=”1/2″][vc_tta_accordion color=”peacoc” active_section=”1″][vc_tta_section title=”What is COBOL?” tab_id=”1563535635560-38176fe8-3385″][vc_column_text]COBOL is abbreviated as Common Business Oriented Language and it is one of the oldest programming languages. It primarily used for business, finance and administrative systems for companies.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are the different data types in COBOL?” tab_id=”1563535635576-3b74acf2-f7d9″][vc_column_text]There are three data types in Cobol:

  • Alpha-numeric (X)
  • Alphabetic (A) and
  • Numeric (9)

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the difference between subscript and index?” tab_id=”1563535720481-8cc2488a-bde9″][vc_column_text]Subscript refers to the occurrence of an array  but index is the displacement from the beginning of the array.

An index can only be modified using PERFORM, SEARCH & SET.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the difference between performing a SECTION and a PARAGRAPH?” tab_id=”1563535720956-ee571717-d593″][vc_column_text]SECTION will have all the paragraphs that are part of the section, to be performed.

PARAGRAPH will have only that paragraph to be performed.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the difference between CONTINUE & NEXT SENTENCE?” tab_id=”1563535721416-5622c5ce-b60d”][vc_column_text]CONTINUE is like a null statement and it continues execution, while NEXT SENTENCE transfers control to the next sentence.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are the different OPEN modes available in Cobol?” tab_id=”1563535721897-186e3996-9169″][vc_column_text]Open modes can be used for

  • Input
  • Output
  • Input – Output
  • Extend

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is Static and Dynamic linking?” tab_id=”1563535722328-1035ec1e-ddf0″][vc_column_text]In static linking, called subroutine  links  into the calling program, while in dynamic linking, the subroutine & the main program will exist as separate modules. Dynamic and Static linking can be achieved by choosing either the DYNAM or NODYNAM link edit option.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the use of EVALUATE statement?” tab_id=”1563535723540-7c955353-4e9e”][vc_column_text]Evaluate is just like a case statement or it can be used like a Nested IFs. The difference between EVALUATE and case is that  ‘break’ is not used in Evaluate statement and the control comes out of the EVALUATE once a match is found.[/vc_column_text][/vc_tta_section][vc_tta_section title=” What is the difference between PERFORM … WITH TEST AFTER and PERFORM … WITH TEST BEFORE?” tab_id=”1563535724080-3148e6ce-a1ab”][vc_column_text]If TEST BEFORE is specified, the condition is tested at the beginning of each repeated execution of the specified PERFORM range.

If TEST AFTER is specified, the condition is tested at the end of the each repeated execution of the PERFORM range. The range is executed at least once in TEST AFTER.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the point of the REPLACING option of a copy statement?” tab_id=”1563535724576-90632474-9f3a”][vc_column_text]REPLACING allows for the same copy to be used more than once in the same code by changing the replace value.

COPY <Name> REPLACING BY[/vc_column_text][/vc_tta_section][vc_tta_section title=”What kind of error is trapped by ON SIZE ERROR option?” tab_id=”1563535725008-060733f2-c0f0″][vc_column_text]ON SIZE ERROR option is raised when there is

  • fixed-point overflow
  • Zero raised to the zero power
  • Division by 0
  • Zero raised to a negative number
  • A negative number raised to a fractional power.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the difference between Structured COBOL Programming and Object Oriented COBOL programming?” tab_id=”1563535725492-7b940535-bb95″][vc_column_text]Structured programming is logical way of programming where the functionalities are divided into modules and helps write the code logically.

Object Oriented Cobol language is a Natural way of programming in which you identify the objects, and then write functions and procedures around that object.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the LOCAL-STORAGE SECTION?” tab_id=”1563535725920-260f5042-2c3a”][vc_column_text]Local-Storage is allocated each time the program is called and will be de-allocated when the program stops via an EXIT PROGRAM, GOBACK, or STOP RUN. It is defined in the DATA DIVISION after WORKING-STORAGE SECTION[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are INPUT PROCEDURE and OUTPUT PROCEDURE?” tab_id=”1563535726452-a30ff790-4d9a”][vc_column_text]In the INPUT PROCEDURE, the input file is opened, records are read and edited and then are released to the sorting operation. Finally the file will be closed.

[plain]RELEASE recordname FROM inputrecord[/plain]

In the OUTPUT PROCEDURE, output file is opened, the sorted record is returned to the Output record and then the record will be written. Finally the file will be closed.

[plain]RETURN file RECORD into outputrecord[/plain][/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the use of LINKAGE SECTION?” tab_id=”1563535726884-a1beb199-35de”][vc_column_text]The linkage section is used to pass data from one program to another program or to pass data from a procedure to a program. It is part of a called program that maps to data items in the calling program’s working storage.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are the access modes of START statement?” tab_id=”1563535727425-03e08a3e-2e5e”][vc_column_text]Access modes are SEQUENTIAL or DYNAMIC for the start statement.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is an in-line PERFORM?” tab_id=”1563535728685-199286f1-076b”][vc_column_text]An IN-LINE PERFORM Statement allows the routine being performed to be nested within the perform statement itself instead of being a seperate paragraph

The PERFORM and END-PERFORM statements are used to block the cobol statements between them. In line PERFORM work as long as there are no internal GO TOs, not even to an exit.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Which division and paragraphs are mandatory for a COBOL program?” tab_id=”1563535729178-c912b222-fbc8″][vc_column_text]Identification division and Program ID are mandatory for a COBOL program.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the difference between Global and External Variables?” tab_id=”1563535729644-1a5f2c12-85ea”][vc_column_text]Global variables are accessible only to the batch program whereas external variables can be referenced from any batch program residing in the same system library.[/vc_column_text][/vc_tta_section][vc_tta_section title=” What is Pic 9v99 Indicates?” tab_id=”1563535730101-95ab14a9-38b4″][vc_column_text]Pic 9v99 is a three position Numeric field with an implied or assumed decimal point after the first position.

Here,  v means an implied decimal point.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What guidelines should be followed to write a structured COBOL program?” tab_id=”1563535730540-42592ed5-6ce5″][vc_column_text]Following guidelines to be following while writing Cobol program:

  • Use ‘EVALUATE’ statement for constructing cases.
  • Use scope terminators for nesting.
  • Use in-line Perform statement for writing ‘do’ constructions.
  • Use Test Before and Test After in the Perform statement while writing Do-While statements.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”How do we get current date from system with century?” tab_id=”1563535730969-cc51fb42-26a1″][vc_column_text]Current date with the century is achieved by using Intrinsic function called FUNCTION CURRENT-DATE.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are all the divisions of a COBOL program?” tab_id=”1563535731469-be8a20e2-b05d”][vc_column_text]There are four divisions in a cobol program:


[/vc_column_text][/vc_tta_section][vc_tta_section title=” What is a SSRANGE and NOSSRANGE?” tab_id=”1563535732725-c92a0c9f-5d4a”][vc_column_text]These are options for a compiler to find the subscript out of range. NOSSRANGE is the default option where there will not be any run time error if index or subscript went out of a range.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is COMP-1? COMP-2?” tab_id=”1563535733508-06d52708-7b1f”][vc_column_text]COMP-1  is a Single precision floating point and uses four bytes. COMP2  is the double precision floating number and uses eight bytes.[/vc_column_text][/vc_tta_section][/vc_tta_accordion][/vc_column][vc_column css_animation=”fadeInRight” width=”1/2″][vc_tta_accordion color=”peacoc” active_section=”1″][vc_tta_section title=”What is the difference between PIC 9.99 and PIC9v99?” tab_id=”1563535640335-34d5865b-5a87″][vc_column_text]PIC 9.99 is a four position field that actually contains a decimal point where as PIC 9v99 is three position numeric field with assumed decimal position.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the Purpose of Pointer in the string?” tab_id=”1563535640352-a7d70145-a2ea”][vc_column_text]The Purpose of Pointer is to specify the leftmost position within receiving field where the first transferred character will be stored.[/vc_column_text][/vc_tta_section][vc_tta_section title=” What is binary search?” tab_id=”1563535736792-fd2e184e-8adc”][vc_column_text]First, we have to compare the item to be searched with the item at the center.

If it matches, it is good to go with the value else repeat the process with the left half or the right half depending on where the item lies.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the difference between a binary search and a sequential search?” tab_id=”1563535737256-2ea4f634-fed4″][vc_column_text]In a binary search, the table element key values will be in ascending or descending sequence. The table is ‘halved'(Divided into two) to search for equal to, greater than or less than conditions until the element is found.

In a sequential search, the table is searched from top to bottom, so the elements do not have to be in a specific sequence.

The binary search is much faster for more tables, while sequential Search works well with lesser ones. SEARCH ALL is used for binary search; SEARCH for sequential search.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Can a Search can be done on a table with or without Index?” tab_id=”1563535737760-459854ee-ffab”][vc_column_text]No, the table must be indexed to search on a table.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are the different rules to perform a Search?” tab_id=”1563535738224-a1d4baad-a933″][vc_column_text]The SEARCH can be applied to a table

  • Which has OCCURS clause
  • INDEXED BY phrase
  • Search Index must have some initial value
  • Set the index value to 1

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?” tab_id=”1563535738628-cb0ba432-7573″][vc_column_text]TEST BEFORE is the default statement and the condition is checked before executing the instructions under Perform.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are the different rules of SORT operation?” tab_id=”1563535739789-776a7c9e-9e68″][vc_column_text]SORT can be performed when

  • Input and Output files must remain closed
  • Working file must have a select clause
  • Input and Output files have FD entries
  • Work file should have short description in File Section

[/vc_column_text][/vc_tta_section][vc_tta_section title=” A table has two indexes defined. Which one will be used by the SEARCH?” tab_id=”1563535740216-7d9e6a8a-7a2c”][vc_column_text]The index named first can be used by search.[/vc_column_text][/vc_tta_section][vc_tta_section title=”When is a scope terminator mandatory?” tab_id=”1563535740633-f1b0b980-e526″][vc_column_text]Scope terminators are mandatory for in-line PERFORMS and EVALUATE statements. Make scope terminator as explicit for good coding standards.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Why is it necessary that file needs to be opened in I-O mode for REWRITE?” tab_id=”1563535741092-c8aa0f21-3f61″][vc_column_text]Before the REWRITE is performed, the record must be open and read from the file. Therefore, the file must be opened in I-O mode for rewrite functionality.[/vc_column_text][/vc_tta_section][vc_tta_section title=”How can we find that module can be called – whether DYNAMICALLY or STATICALLY?” tab_id=”1563535741849-957f135a-57ef”][vc_column_text]The ONLY way is to look at the output of the linkage editor or the load module.

If the module is being called DYNAMICALLY then it will not exist in the main module, if it is being called STATICALLY then it will be exist in the load module.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Which Search verb is equivalent to PERFORM…VARYING?” tab_id=”1563535742393-e10e9e0e-c808″][vc_column_text]The serial SEARCH verb is equivalent to Perform.. Varying statement and it is nothing but search without ALL.[/vc_column_text][/vc_tta_section][vc_tta_section title=”How many Sections are there in Data Division?” tab_id=”1563535743637-e585ca8f-3241″][vc_column_text]There are six sections in Data Division:

  • File Section
  • Working Storage Section
  • Local Storage Section
  • Screen Section
  • Report Section
  • Linkage Section

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the difference between comp and comp-3 usage?” tab_id=”1563535744233-1e23be9e-f65d”][vc_column_text]Comp is for binary usage, while comp-3 indicates packed decimal.[/vc_column_text][/vc_tta_section][vc_tta_section title=” What does Exit do?” tab_id=”1563535744741-5254c94e-bca2″][vc_column_text]If EXIT is used, it won’t be more than only sentence within a  paragraph.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Give some examples of command terminators?” tab_id=”1563535745237-47d2b0dc-61af”][vc_column_text]End IF and End Evaluate are the examples of command terminators.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the difference between Call and a Link?” tab_id=”1563535745805-803ba0e2-5623″][vc_column_text]A call is an actual COBOL command which provokes an external program and returns. Link is same as Call but it does not belong to a COBOL verb.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Which mode is used to operate the sequential file?” tab_id=”1563535746829-f5a4fd06-8277″][vc_column_text]An O-I mode (Output/Input mode) is used for starting and initiation of processing files. Processing of files is determined by successful execution of an OPEN statement.[/vc_column_text][/vc_tta_section][vc_tta_section title=” How many bytes S(8) comp field occupy and its maximum value?” tab_id=”1563535747293-01a4b432-9934″][vc_column_text]S(8) can store 4 bytes and the highest value is 99999999.[/vc_column_text][/vc_tta_section][vc_tta_section title=”How arrays can be defined in COBOL?” tab_id=”1563535747934-0f3f8e08-19ca”][vc_column_text]Arrays can be defined as –

05 Array1 PIC X(9) which occurs 10 times

05 Array2 PIC X(9) which occurs 20 times[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are literals?” tab_id=”1563535748545-dc663681-b447″][vc_column_text]A literal is a data item which consists value by itself. It cannot be referred by a name. They are constant data items. There are two types of literals:

  • String / Alphanumeric Literals
  • Numeric Literals

[/vc_column_text][/vc_tta_section][vc_tta_section title=” What is a report item?” tab_id=”1563535749133-e882b36a-dea1″][vc_column_text]A report item is a field to be printed which has Edit Symbols.[/vc_column_text][/vc_tta_section][vc_tta_section title=” Can we redefine the field of X(200) to less than 200?” tab_id=”1563535749653-6b4aa50b-b5a1″][vc_column_text]Yes, we can redefine the values from bigger number to smaller number.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is length is Cobol?” tab_id=”1563535750269-c15f03ce-f0ab”][vc_column_text]Length is like a special register to have the length of a group or an elementary item.


WhatsApp us