You are on page 1of 14

EDS

COBOL TEST

COBOL

TEST

Instructions : Do not write on this quiz paper. Please answer on the sheet provided. Time : 1hr. 1. Marks : 80

Which one of the following is an INCORRECT specification for a data-nme? a) LAST-NAME b) 1234 c) 12A3 d) SALES Which of the following is an INVALID paragraph name ? a) 999 b) A-1 c) A+1 d) XX9 Level numbers range from _____ to _____ . a) b) c) d) 00, 01, 01, 00, 49 50 49 50

2.

3.

4.

Two data names at the same level within a record must a) b) c) be unique not necessarily unique necessarily unique

5.

d) none of the above With COBOL 85 the use of the word FILLER. a) b) c) d) cannot be ommitted is used to report memory usage can be omitted entirely is a form feed control command to the printer

6. a) b) c) d)

The maximum number of digits in a numeric item is 16 17 18 20


Ver 0.00a Page 1

ER/ORG/TST/001

EDS

COBOL TEST

7. Which of the following is not a VALID COBOL figurative constant a) b) c) d) 8. ZERO ZEROS ONES QUOTES

A STOP RUN statement a) b) c) d) 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 a) b) c) d) 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) b) c) DATE-COMPILED. PROGRAM-ID. AUTHOR. a) INSTALLATION.

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 the object of PERFORM is executed.

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.
ER/ORG/TST/001 Ver 0.00a Page 2

EDS

COBOL TEST

(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

The following table gives the PICTURE declarations of the values assumed (immediately preceeding the arithmetic statement given in each question ) by four data names DATA1, DATA2, DATA3 and DATA4.

Data Name

PICTURE

Value immediately prior to the execution of the statement. in bytes numerical value
Ver 0.00a Page 3

ER/ORG/TST/001

EDS

COBOL TEST

DATA1 DATA2 DATA3 DATA4

999 999V9 99V99 999V9

024 0199 0018 012.0

24 19.9 0.18 12

Answer the following four questions with reference to the above table : 17. The statement ADD DATA1 DATA2 TO 23 results in a) values of 47 and 42.9 for DATA1 and DATA2 respectively. b) values of 22 and 11.2 for DATA1 and DATA2 respectively. c) all the data-names retain their values. d) a syntax error.

ER/ORG/TST/001

Ver 0.00a

Page 4

EDS

COBOL TEST

18.

The statement SUBTRACT DATA3 0.79 FROM 100.0 GIVING DATA2 ROUNDED results in a) values of 0.18 and 99.1 for DATA3 and DATA2 respectively. b) values of 0.18 and 99.0 for DATA3 and DATA2 respectively. c) values of 99.03 and 99.0 for DATA3 and DATA 2 respectively. d) a syntax error.

19.

The statement MULTIPLY DATA2 by 10.0 GIVING DATA3 ROUNDED ON SIZE ERROR NEXT SENTENCE results in a) values of 19.9 and 199.0 for DATA2 and DATA3 respectively. b) values of 19.9 and 99.0 for DATA2 and DATA3 respectively. c) all the data-names retaining their values d) a syntax error.

20.

The statement DIVIDE DATA4 INTO DATA1 ON SIZE ERROR MOVE 0 TO DATA1. results in a) values of 2 and 12.0 in DATA1 and DATA4 respectively. b) values of 0 and 12.0 in DATA1 and DATA4 respectively. c) all the data-names retaining their values d) a syntax error.

21.

Data-names BAL1, BAL2, BAL3 and BAL4 have the following definitions in the WORKING-STORAGE section. 01 01 01 01 the statement MOVE -5 TO BAL1, BAL2, BAL3, BAL4. will produce the following bytes in BAL1, BAL2, BAL3 and BAL4 respectively BAL1 BAL2 BAL3 BAL4 PIC PIC PIC PIC 99+ 9CR ZZZ

: (b stands for space) a) b)


ER/ORG/TST/001

5b 5-

55-

5CR 5bb

5bb 005
Page 5

Ver 0.00a

EDS

COBOL TEST

c) d) 22.

55-

55b

5CR 5bb

bb5 500

Data names A,B and C assume values 2, 3 and 4 respectively , at some stage in the computation, when the following PROCEDURE DIVISION statement is executed. What is the resulting value of D ? IF (A > B) OR (B < C) COMPUTE D = A + B * C ELSE COMPUTE D = A * B + C . a) b) c) d) 14 20 10 none of the above.

23.

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) b) c) d) 24. LINE-1 is always written. LINE-2 is always written. Action depends on the computer system on which the program is run. compiler error results.

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) b) 0 72
Ver 0.00a Page 6

ER/ORG/TST/001

EDS

COBOL TEST

c) d) 25.

108 135

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 1. 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 1. d) Do the paragraph B010-PROCESS-PARA once if STATUS has a value other than 1.

26.

The statement PERFORM B010-CALC-PARA VARYING I FROM 1 BY 1 UNTIL I = 5 causes this paragraph to be entered . a) b) c) d) in a continous loop, at least until I overflows thrice four times none of the above

27.

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

28.

ER/ORG/TST/001

Ver 0.00a

Page 7

EDS

COBOL TEST

29.

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.

30.

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. 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. Which one of the following is NOTcorrect? (a) ADD A, B GIVING C, D. (b) ADD CORRESPONDING A TO C. (c) ADD A TO B GIVING C. (d) ADD A TO B, C TO D. 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. Which one of the following if NOT a PROCEDURE DIVISION verb? (a) ADD (b) SUBTRACT (c) INSERT (d) DELETE

31.

32.

33.

34.

ER/ORG/TST/001

Ver 0.00a

Page 8

EDS

COBOL TEST

35.

Which of the following PICTURE clauses is invalid as a floating symbol? (a) (b) $ (c) S (d) + In COBOL-85, the minimal set of clauses that are necessary to set up and initialise a table of integer values to all zeros in the WORKINGSTORAGE section consists of a) b) c) d) VALUE VALUE, OCCURS VALUE, OCCURS, REDEFINES VALUE, OCCURS, REDEFINES, INDEXED BY

36.

37. 01

Assuming a 32-bit word , how many words does the following occupy. BILLS. 05 10 INDIVIDUAL-BILL occurs 10 times. BILL-NO PIC 9(5)V99 SYNC. 10 BILL-AMOUNT PIC 9(3) SYNC.

a) b) c) d) 38. 01 01

1 word. 2 words. 3 words. 4 words

Study the following WORKING_STORGAGE SECTION entries: TABLE-ENTRY OCCURS 100 TIMES INDEXED BY ITAB. 10 TAG-NO PIC 99. 10 TAG-NAME PIC X(20). TAG-DATA PIC 99.

Which of the four choices can be considered as the best description of the SEARCH statement. SEARCH TABLE-ENTRY AT END PERFORM PRINT-TAG-ERROR WHEN TAG-DATA = TAG-NO(ITAB) PERFORM PROCESS-TAG.

ER/ORG/TST/001

Ver 0.00a

Page 9

EDS

COBOL TEST

a) b) c) d) 39.

There is a syntax error in the SEARCH statement. Statement is syntactically correct but may fail to do the search correctly if ITAG is not initailised before the SEARCH statement. There is a syntax error in the table definition. Statement is syntactically correct; the index value gets automatically initialised.

A table GRADE-TABLE has the following record description in a COBOL program. 01 GRADE-TABLE. 05 GRADE OCCURS 5 TIMES. 10 CLASS-TYPEOCCURS 9 TIMES. 15 YEAR OCCURS 9 TIMES.

It is desired to pick up the first grade in the 9th class-type in the 7th year. Which of the following will give the correct field ? a) b) c) d) 40. GRADE(7,9,1) YEAR (1,9,7) GRADE(1,9,7) YEAR (7,9,1)

A MOVE CORRESPONDING is not usually used because : a) b) c) d) it is a very time-consuming way of moving data. it uses more memory compared to moving each field using MOVE instead of MOVE CORR . A MOVE CORR may produce unintended results if data names are altered during program modification. none of the above.

41.

A data-name HRD-WORD meant for holding the text for a report header is specified in the WORKIN-STORAGE SECTION as : HRD-WORD PIC X(30) VALUE ---------REPORT LIST---------. The value of HRD-WORD is changed at execution time by the INSPECT HRD-WORD REPLACING LEADING - BY *. INSPECT HRD-WORD TALLYING COUNT-1 FOR ALL - BEFORE INITIAL COUNT-2 FOR ALL - AFTER . statements .

ER/ORG/TST/001

Ver 0.00a

Page 10

EDS

COBOL TEST

After the two INSPECT statements are executed in the given order names COUNT-1 and COUNT-2 will assume values a) b) c) d) 42. 9 and 9 respectively. 0 and 9 respectively. 0 and 0 respectively. 9 and 0 respectively.

the data-

A COBOL program contains the WORKING-STORAGE SECTION declaration 01 A-1. 05 10 05 A-2. 05 10 05 B1 C D B2 C D OCCURS 10 TIMES. OCCURS 5 TIMES PIC X. PIC 99. OCCURS 10 TIMES. OCCURS 5 TIMES PIC X. PIC 99.

01

43.

Which of the following statement is INCORRECT . a) b) c) d) MOVE SPACES TO B2(5). MOVE SPACE TO C OF B1 OF A-1(1,1). MOVE SPACE TO C(1,1) OF B1 OF A-1. MOVE SPACE TO B2(D OF A-1).

44.

Which of the following is not necessarily true . a) b) c) d) Structured programming improves the maintainability of a program. Structured programming is possible in COBOL. Structured programming reduces the execution timings. Structured programming enables a programmer to concentrate on one function at one time.

45.

IN-QNT is a formal parameter in a subprogram. Which one of the following is NOT true about IN-QNT ? a) b) c) d) IN-QNT should appear in the PROCEDURE DIVISION header of the subprogram. The actual parameter in the CALL statement corresponding to the INQNT should have the same name . IN_QNT should appear in the LINKAGE SECTION of the subprogram. none of the above.
Ver 0.00a Page 11

ER/ORG/TST/001

EDS

COBOL TEST

46.

The COBOL verb that is not directly concerned with an index name is ... (a) SET (b) SEARCH (c) PERFORM (d) SORT

47.

The PROCEDURE DIVISION of a program contains the statement WRITE MASTER-REC This clearly suggests that the OPEN statement for this file must NOT be (a) OPEN I-O (b) OPEN INPUT (c)OPEN OUTPUT (d) OPEN EXTEND The PROCEDURE DIVISION OF a program contains the statement ... START MASTER-FILE KEY IS > REC-KEY. This clearly suggests that the SELECT clause specification for MASTER-FILE must be (a) ORGANIZATION IS INDEXED with ACCESS MODE RANDOM. (b) ORGANIZATION IS INDEXED with ACCESS MODE DYNAMIC. (c) SEQUENTIAL with ACCESS MODE SEQUENTIAL (d) SEQUENTIAL with ACCESS MODE RANDOM. Which of the following is true about the file which is referenced in a DELETE statement? (a) It must be opened in INPUT mode. (b) It must be opened in OUTPUT mode. (c) It must be in I-O mode. (d) File Access mode must be RANDOM.

48.

49.

True or False
50. 51. 52. 53. 54. The END-PERFORM is present in the COBOL-74 standard. In the COBOL-85 standard, the END-IF must always be used to terminate an IF statement. SEARCH ALL denotes a binary search. An index can be manipulated by a MOVE statement The ASCENDING or DESCENDING KEY clause is required whenever the SEARCH ALL is applied to a table.
Ver 0.00a Page 12

ER/ORG/TST/001

EDS

COBOL TEST

55. 56.

A SEARCH statement automatically initializes the index to 1 in the case of a sequential search. The statement CLOSE INPUT BIO-DATA-FILE is valid.

57. WRITE EMP-DATA-RECORD AT END MOVE 1 TO CODE. The above is not valid in COBOL. 58. KOUNT FIRST-NAME PIC 9. PIC X(10) VALUE 'EDS'.

MOVE 1 TO KOUNT. STRING FIRST-NAME DELIMITED BY SPACES INTO NAME-OUT WITH POINTER KOUNT. After the STRING operation the value of KOUNT is 7 59. 60. 61. 62. 63. If the OUTPUT PROCEDURE is specified with the SORT verb, then the INPUT PROCEDURE is required The order of the parameters passed to the program is determined by the order of their declaration in the LINKAGE SECTION. The ALTERNATE KEY associated with a record must be a unique key value in the file. Relative files can be opened in EXTEND mode. The instructions

MOVE 08 TO EMP-NO START FILE1 KEY IS > EMP-NO INVALID KEY DISPLAY "ERR". will read a record into storage with a key greater than 8. 64. If you code a USE AFTER ERROR PROCEDURE ON filename statement, you need not use an INVALID KEY with the READ or WRITE statement to dislay error messages. COBOL takes care of collision resolution in case of relative files.
Ver 0.00a Page 13

65.

ER/ORG/TST/001

EDS

COBOL TEST

66.

With the MERGE statement, pre-processing is done with the help of INPUT PROCEDURE and post-processing is taken care of by the OUTPUT PROCEDURE. Records stored randomly in a relative file can be accessed sequentially. A table described by a DEPENDING ON CLAUSE is allocated space dynamically on execution. If we require that the instructions in a loop are to be executed at least once before testing the condition COBOL provides the TEST AFTER option with the PERFORM ... UNTIL. The sign is not normally allocated a separate storage unit. Indexed files have lower access times as compared to relative files. For a relative file, the RELATIVE KEY is part of the data record. SYNC results in compact storage of data items with no wastage between the data items COMP increases the speed of computation as compared to DISPLAY. REDEFINES clause allocates another storage area for the item being redefined. A RELATIVE KEY is optional when reading from or writing to a realtive file sequentially The FILE STATUS clause can be used with the SELECT statement to determine the specific type of error that occured when reading or writing to a file

67. 68. 69.

70. 71. 72. 73. 74. 75. 76. 77.

The next three questions pertain to the following : The content of a data item stored with a picture clause of 9(7)v99 is 1234567.89. What will be the resulting numbers printed in each of the following cases: 78. 79. 80. 9(6)v99 *(8).** $(5).$$

ER/ORG/TST/001

Ver 0.00a

Page 14

You might also like