COBOL top 25 questions gives you confidence for interviews and to use in your current projects.
1. Which one of the following is an INCORRECT specification for a data-nme?
- LAST-NAME
- 1234
- 12A3
- SALES
2. Which of the following is an INVALID paragraph name ?
- a) 999
- b) A-1
- c) A+1
- d) XX9
3. Level numbers range from _____ to _____ .
- a) 00, 49
- b) 01, 50
- c) 01, 49
- d) 00, 50
4. Two data names at the same level within a record must
- be unique
- not necessarily unique
- necessarily unique
- none of the above
5.With COBOL 85 the use of the word FILLER?
- cannot be ommitted
- is used to report memory usage
- can be omitted entirely
- is a form feed control command to the printer
6. The maximum number of digits in a numeric item is?
- a) 16
- b) 17
- c) 18
- d) 20
7. Which of the following is not a VALID COBOL figurative constant?
- ZERO
- ZEROS
- ONES
- QUOTES
8. A STOP RUN statement?
- must appear only once in a program
- can appear in several places in a program
- was not available in COBOL 74
- is used to stop the printer.
9. The VALUE clause
- is used to obtain the value of a variable.
- is used to initialise a variable to a certain value.
- cannot be used in the data division of a program.
- cannot be used to initialise a nonnumeric varaible.
10.Which of the following declarations is essential in the IDENTIFICATION DIVISION?
a) DATE-COMPILED.
b) PROGRAM-ID.
11.When the UNTIL option is used with PERFORM verb, the condition is tested
a) before
b) after
c) before and after
d) not at all
12.The association between a file-name and physical device on which the file reside is established by the select statement which should appear in :
(a) FILE section. ENVIRONMENT division.
(b) FILE-CONTROL paragraph, INPUT-OUTPUT section, ENVIRONMENT, division.
(c) CONFIGURATION section, ENVIRONMENT division.
(d) FILE section, DATA division.
13.The BLANK WHEN ZERO clause can be applied to
a)Numeric edited items
b)Alphanumeric edited items
c) Both of the above
d) is not a valid clause in COBOL – 85
14.One of the following correctly describe the concepts of ‘statement’ and ‘sentence’ in COBOL:
(a) A COBOL sentence is a sequence of COBOL sentences, the last of which is terminated by a period.
(b) A COBOL sentence is a sequence of COBOL statements, the last of which is terminated by a period.
(c) There is no concept of ‘sentence’ in COBOL. English sentences can, however, appear in comment lines.
(d) The concept of ‘sentence’ and ‘statement’ are identical in COBOL.
15. Use of the EXTEND option with the OPEN verb causes the file to be positioned
a) at the first record
b) at the last record
c) after the last record
d) before the last record
16.The Procedure Division entry for the called program includes a ______ clause.
a) GIVING
b) USING
c) VALUE
d) PIC
17.IF CHAR-1 < CHAR-2
WRITE LINE-1
ELSE
WRITE LINE-2
If before executing this statement, CHAR-1 contains alphanumeric literal ‘1’ and CHAR-2 contains alphanumeric literl ‘A’ then …
a) LINE-1 is always written.
b) LINE-2 is always written.
c) Action depends on the computer system on which the program is run.
d) compiler error results.
18.IF PAY-CODE = ‘A’
IF PAY-BASIC < 500 MOVE 0 TO PAY-DEDUCT
ELSE IF PAY-BASIC < 1000 MOVE 120 TO PAY-DEDUCT
ELSE MOVE 150 TO PAY-DEDUCT
ELSE MOVE 80 TO PAY-DEDUCT.
COMPUTE PAY-DEDUCT = PAY-DEDUCT * 0.9.
If this program segment is entered with PAY-CODE = ‘B’,
PAY-BASIC = 900 AND PAY-DEDUCT = 90
the resulting value of PAY-DEDUCT will be ...
a) 0
b) 72
c) 108
d) 135
19.What is the correct interpretation of the statement
PERFORM B010-PROCESS-PARA UNTIL STATUS = 1.
a) Do the paragraph B010-PROCESS-PARA once if STATUS has a value of
b) Keep repeating paragraph B010-PROCESS-PARA as long as STATUS has a value 1.
c) Keep repeating paragraph B010-PROCESS-PARA as long as STATUS has a value other than
d) Do the paragraph B010-PROCESS-PARA once if STATUS has a value other than 1.
20.In the choices below, a level number is followed by a COBOL clause is expected to go with the data descrtption at that level. Which of them is an incorrect pair?
(a) 01 PICTURE
(b) 10 REDEFINES
(c) 20 RENAMES
(d) 88 VALUES
21. The function of the SYNCHRONIZED clause is to ensure that:
(a) The data-name begins or/and ends at a word boundary for word oriented computers.
(b) The record begins or/and ends at a word boundary for word oriented computers.
(c) The record always stays at a disk sector (disk segment) boundary for disk files.
(d) The data-name assumes binary and not DISPLAYnumber representation.
22.The data-name LINE-1 has following FILE section entry:
05 LINE-1 PIC X(25)
The effect fo the statement …
MOVE SPACE TO LINE-1
would be to :
(a) Move spaces to all the bytes of LINE-1.
(b) Move a single space to the first byte of LINE-1 leaving the others unchanged.
(c) Move a single space to the last byte of LINE-1 leaving the others unchanged.
(d) Nove of the above.
23.Indicate which one of the following is not a valid form of PERFORM statement.
(a) PERFORM P1 THREE TIMES.
(b) PERFORM P1 VARYING I FROM 1 BY 1 UNTIL I > 3.
(c) PERFORM P1 UNTIL MORETHAN3.
(d) PERFORM P1 THRICE.
(e) PERFORM P1 UNTIL THREE > 3.
24.The following statement is used in a COBOL program:
PERFORM UPDATE-INPUT UNTIL DONE.
(a) DONE is a data-name whose value gets decremented at each entry of the paragraph.
(b) DONE is a data-name whose value gets decremented at each exit of the paragraph.
(c) DONE is a data-name whose value gets defined in an exception heading section.
(d) DONE is a condition name.
25.Which one of the following is NOTcorrect?
(a) ADD A, B GIVING C, D.
(b) ADD CORRESPONDING A TO
(c) ADD A TO B GIVING C.
(d) ADD A TO B, C TO D.
26.Which of the following is incorrect?
(a) MULTIPLY A BY B GIVING C.
(b) MULTIPLY A INTO B.
(c) DIVIDE A BY B GIVING C.
(d) DIVIDE A INTO B.
27.Which one of the following if NOT a PROCEDURE DIVISION verb?
(a) ADD
(b) SUBTRACT
(c) INSERT
(d) DELETE