0% found this document useful (0 votes)
126 views

Module Test

This document contains a multiple choice test on COBOL concepts. There are 37 multiple choice questions testing topics like data division structures, file definitions, PERFORM statements, arithmetic operations, and CALL statements. The test is evaluating a student's understanding of basic to intermediate COBOL programming concepts.

Uploaded by

abjanuary
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
126 views

Module Test

This document contains a multiple choice test on COBOL concepts. There are 37 multiple choice questions testing topics like data division structures, file definitions, PERFORM statements, arithmetic operations, and CALL statements. The test is evaluating a student's understanding of basic to intermediate COBOL programming concepts.

Uploaded by

abjanuary
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 13

MODULE TEST STUDENT NAME STUDENT ID TOTAL MARKS 1. 2.

COBOL

A cobol program should have atleast one paragraph True/ False. What is the function of EXIT statement below. PERFORM EXIT DISPLAY HEAL THE WORLD END-PERFORM. DISPLAY HELLO WORLD. STOP RUN. the above statement prints HEAL THE WORLD TRUE / FALSE.

3. Write the functions of GOBACK and EXIT PROGRAM statement. 4. Which division is more dependant to the machine. A. IDENTIFICATION DIVISION, B.ENVIRONMENT DIVISION C. DATA DIVISION. D. PROCEDURE DIVISION. 5. In which division and section the file has to be defined. A. DATA DIVISION & FILE-SECTION B. DATA DIVISION& WORKING-STORAGE SECTION C. PROCEDURE DIVISION. D. ENVIRONMENT DIVISION & INPUT-OUTPUT SECTION 6. which para we cant code in Input-Output Section. A. FILE-CONTROL, B. I-O CONTROL, C. INPUT-CONTROL D.OUTPUTCONTROL. 7. In which lev-el number the occurs clause are not used. A. 49 B. 77 C. 01 D. 66, 88 E. 02-48 8. The function of INITIALIZE verb is

1 .Sets alphabets, alphanumeric, alphanumeric edited to spaces. 2. Sets numeric, numeric edited to zeros. 3. Sets every thing in the group to Blank Space. 4. Do nothing for Occurs Depending on. A.3 B. 1 & 2 C. 3 & 4 D. 1, 2 & 4

9. If I use start verb in cobol what should be the access mode ? A. SKIP-SEQUENTIAL B.RANDOM C. DYNAMIC D. SEQUENTIAL 10. X(3) X(4)

1. BOY < GIRL 2. BOY > BIRD 3. ABC > abc 4. 1A2 < XYZ Choose the false conditions A. 2 only B. 3 only C. 2 & 1 D. 4 only E.all are false(compilation error) 11. WORKING-STORAGE SECTION. 01 WS-N PIC 9(3) VALUE 5. PROCEDURE DIVISION. PERFORM PARA-1 WS-N TIMES. STOP RUN. PARA-1. ADD 5 TO WS-N. PERFORM PARA-2 VARYING A FROM 15 BY -3 UNTIL A = 0. PARA-2. PERFORM PARA-3 VARYING B FROM 5 BY 2 UNTIL B > 15. PARA-3. DISPLAY HELLO WORLD. How many times the above display statement will execute A. 20 B. 25 C. 30 D. 35 E. 120 F. 140 G. 150

12 . From the above program, how many times the statement SUB1 will execute ? A. 13. 4 B. 5 C. 6 D. 7

Among the following mark the invalid scope terminator A. END-IF B. END- READ C. END PERFORM

D. END PROGRAM MAIN1 14. WORKING-STORAGE SECTION. 77 WS-COUNT PIC 99. PROCEDURE DIVISION. PERFORM PARA1 VARYING A FROM 1 BY 2 UNTIL A > 3 AFTER B FROM 4 BY 5 UNTIL B > 6 AFTER C FROM 7 BY 8 UNITL C > 9. STOP RUN. PARA1. DISPLAY HEAL THE WORLD. How many times the above display statement will execute ? A. 1 B. 2 C. 3 D. 4 E. 6 F. 9 G. Infinite loop. 15. WORKING-STORAGE SECTION. 77 A PIC 9(3) VALUE 420. 77 B PIC 9(3) VALUE -420 . PROCEDURE DIVISION. DISPLAY A. DISPLAY B. The internal representation for A and B will be A. 42{ & 42} B. D20 & M20 C. d20 & m2 16. Say true or false - A and B are optional = True/False A. INPUT-OUTPUT SECTION & WORKING-STORAGE SECTION B. DATA DIVISION. 17. GREATER THAN, LESS THAN are A. Logical operator B. Relational operator. C. both A & B. D. none of the above

18. Mark the true answers below. A. Both in sequential search and binary search the search sequence starts at first element. B. for sequential search we us SEARCH ALL & for binary it is SEARCH C. Search sequence for sequential is from last & for binary it is middle element D. Search sequence for sequential is from first & for binary it is middle element

19. A. 01 A PIC X(20). 01 B REDEFINE A PIC X(100).

B. 01 DUP-REC. 02 D1 PIC X(50). 02 D2 REDEFINE D1 PIC X(100).

Check the true answeres 1) A and B 2) B only 3) A only 4) NONE 20. 01 BABA. 02 CACA OCCURS 150. 03 AAA. 04 BBB PIC X(4). 04 CCC OCCURS 420. 05 ZZZ OCCURS 360. 05 XXX PIC X(5). 05 SWAP. 49 OUT PIC X(160). Is above declaration is correct ? TRUE/FALSE

21. When you execute the above mentioned program the result will be A. Compile errorbb B. Run Time abend C. Executes success fully

D. Call cannot be made form sub1 to sub2 cos it is contained sub program. 22. How much memory will be allocated for this group. 01 REC-STRUCT. 1 EMP-REC OCCURS 3 TIMES. 03 EMP-NAME PIC A(15). 2 EMP-CODE PIC X(4). 3 EMP-SAL PIC S9(8)V9(2). 3 EMP-SAL-EDIT PIC +9(8).9(2). 4 EXTRA OCCURS 2 TIMES. 49 EMP-PF PIC 9(7) COMP. 49 EMP-BONUS PIC 9(6) COMP-3. 49 TEMP1 COMP-1. 49 TEMP2 COMP-2. 49 EDIT1 PIC ZZZ,ZZZ. 49 EDIT2 PIC ***,***99. 49 EDIT3 PIC XBXBXB. A. 325 B. 225 C. 375 D. 357 23. Calculate the memory allocation for the group. 01 EMP-REC. 02 E-NAME PIC X(10). 02 E-SALARY PIC S9(6) COMP SYNCHRONIZED. 02 E-PF PIC 9(4)V9(2) COMP-3. A. 16 B. 20 C. 22 D. 24 24. Choose the order of DB2 + Cobol Compilation. B. Compilation, Precompilation, Bind, Link-edit, Run A. Precompilation, Compilation, Link edit, Bind, Run C. Link-edit, Bind, Run D. Bind, Link-edit, Run 25. Check the correct order of precedence A. EXP, DIV, MUL, ADD, SUB,UNARY. B. UNARY, EXP, DIV, MUL, ADD, SUB C. NOT,AND, OR D. NOT, OR, AND 26. MOVE 1000 TO ENO. READ INFILE. MOVE 1001 TO ENO. REWRITE IN-REC. From the above code the REWRITE statement is successful. True/ False. 27. If I want to read sequentially form a specific record then what is the procedure.

Ans : start command. 28. Invalid numeric edited picture clause. A. Z B.$ C.V D.- E. * f. None of the above 29. Consider the program below FILE SECTION. FD IN-FILE. 1 REC. 02 WS-NAME PIC X(12). 02 WS-NUMBER PIC X(4). 02 WS-SALARY PIC X(8). WORKING-STORAGE SECTION. 2 WS-REC. 02 WS-NAME PIC X(12) VALUE AUNTY CATHY. 2 WS-NUMBER PIC X(4) VALUE 1043. 02 WS-SALARY PIC X(8) VALUE 4000. If I want to write a data which is in ws-rec to IN-FILE then I should-A. B. C. D. MOVE WS-REC TO IN-FILE, WRITE IN-FILE MOVE WS-REC TO REC, WRITE IN-FILE MOVE WS-REC TO REC, WRITE REC WRITE REC FROM WS-REC. 30. Perform para-1 varying I from 4 by 4 until I > 50 after J from 2 by 2 until J > 10. Stop run. Para-1. COMPUTE I = I + J. How many times para-1 will execute? a. 100 TIMES b. 500 TIMES c. 10 TIMES d. 50 TIMES 31. For the following COBOL code how many times para-1 will execute? Data division. Working-storage section. 01 ws-v1 pic 9(1) value 1. Procedure division. Perform para-1 with test after until ws-v1 = 1 Stop run. Para-1.

Compute ws-v1 = ws-v1 + 1. Display we are in para-1. A. 1 B. 10 B. 9 D. 11 E. Infinite 32. How much memory will be allocated for the below declaration. 1 GROUP1. 2 GROUP2. 3 GROUP3. 04 A PIC X(4). 4 B PIC 9(9)V9(9) COMP. 04 C PIC 9(8)V9(7) COMP-3. A. 37 B. 22 C. 20 D. Declaration error. 33. CALL SUB1 USING BY REFERENCE SARA.

The above mentioned statement is valid True/False. 34. If I have CALL ROUTE1 statement in my application program, which means that it is static call, if i want to make it as dynamic call without altering the statements in program. A. It is not possible to change. B. Usage of PARM=DYNAM while compilation. C. Usage of PARM=NODYNAM while compilation. D. It can be changed only when we alter the program with identifier 35. If I have CALL WS-CALL in my application program A. with default compiler option PARM=NODYNAM this will be static. B. With default compiler option it will throw compile error. C. Run time abend. D. Irrespective of compiler option the program will act as dynamic call 36. Form main program the sub program sub1 is called twice Between first call and second call CANCEL SUB1 is made In subprogram sub1 it is calling another sub program called sub2 When a second call is made from main program, what will happen? A. It terminates the run unit. B. It doesnt call the sub program SUB2. C. the state maintained by the previous call is cancelled forsub1&sub2 D. the state maintained by the previous call is cancelled forsub1 alone. 37. If I want print my data at the top of new page then what write statement I should use ? A. WRITE PRINT-REC FROM DUP-REC AFTER ADVANCING 1 LINE B. WRITE PRINT-REC FROM DUP-REC AFTER ADVANCING 0 LINE

C. WRITE PRINT-REC FROM DUP-REC BEFORE ADVANCING PAGE D. WRITE PRINT-REC FROM DUP-REC AFTER ADVANCING PAGE 38. Choose the valid statements A. It is possible to use redefines clause in file-section B. We can define 88 level number in file-section. C. With out transferring data to condition variable I can set condition names to true. D. The renames clause can be redefined MOVE ABBREVIATE TO FIELD-A. INSPECT FIELD-A CONVERTING ABCDE TO EDCBA. INSPECT FIELD-A ALL REPLACING ABCDE BY EDCBA. What will be the value of FIELD-A when converting option is used = eddravieta What will be the value of FIELD-A when replacing option is used = error. 39.

Cobol questions on 4-3-09 1. to write in wat mode the files can be opened - ouput,i/o 2. if there are 8 elements in an array how many times it will search for linear and binary search. Ans: Linear - max of 8 times Binary - max of 4 times 3.which is not a valid cobol verb? Exit. End program . None of the above 4.default compiler options ? 5.ssrange related wit wat? 6.array boundary can be given by using which option 7.clear abt the exit verb?...wat is the use 8.which one is nested program ?.... four programs given 9.if v initialize occurs depending on wat it ll do

10.use of linkage section.? 11.where file ll be defined?... 12. which is not in data division..? 13.steps in cobol/db2 program compilation 14. one question on if condition like , if a=b or a=c(some expression) which is equivalent statement 15.a program wit perform until condition how many times the para ll be processed 16. 27. 01 A OCCURS 5 TIMES 02 B X(1) VALUE 'H' Ans: HHHHH (not sure)

1. if there are 8 elements in an array how many times it will search for linear and binary search. Ans: Linear - max of 8 times Binary - max of 4 times. 2. size of S9(5) COMP-3. Ans: 3 3. size of a group item they asked in which none of the above is correct.. 4. what is the option for checking ARRAY BOUNDS. Ans: SSRANGE 5. when this statement will be wrong MULTIPLY 0.1 BY A Ans: when A is declared as ZZZ9.9 because we cant manipulate with editing picture clause variables. 6. 77 A PIC 99 VALUE 1. 77 B PIC 99 VALUE 1. PERFORM P1 UNTIL A>8 OR B>10 P1 COMPUTE A = A + 1

COMPUTE B = B + 1 How many times P1 will execute.. Ans: 10 times since OR is used. 7. What is the loop structure used in COBOL.. Ans: PERFORM 8. CICS translators.. Ans: IMS, DLI, LANGL 9. 77 A PIC 99 VALUE ZEROES PERFORM P1 UNTIL A<10 P1 COMPUTE A = A + 1 How many times P1 will be executed. Ans: actually it should be 0 times.. there is no option for 0. so none of the above 10. Verbs used with INSPECT Ans: REPLACING AND TALLYING 11. What is the use of SQLCA. Ans: It will have the declaration for sql error codes, warning codes and etc. 12. Which division machine dependent division. Ans: ENVIRONMENT DIVISION 13. 77 A PIC 99V99 77 B PIC 99V999 ADD B TO A ONSIZE ERROR DISPLAY ERROR If A = 55.35 B=32.756 then Ans: ERROR will be displayed 14. If a we are updating the existing DBRM with new tables added then what option we have to use in order to have the changes Ans: REBIND 15. WRITE OUTFILE What is wrong in the code. Ans: OUTFILE should not be used with WRITE 16. . READ IN-REC . WRITE OUTFILE What is wrong in the code.

Ans: Wrong options used with both READ and WRITE 17. In a sub pgm question the variable was not passed from the main program. Ans: So, it cannot change the value in the subpgm. Or missing USING and LINKAGE SECTION. 18. 2 more question on sub pgm using EXTERNAL keyword. 19. Which division doesnt have a section. Ans: IDENTIFICATION

20. MAIN PGM 77 A PIC 99 VALUE ZEROES .. ADD 50 TO A CALL SUBPGM SUB PGM W-S SECTION 77 A PIC A 99 . PROCEDURE DIVISION. ADD 50 TO A. EXIT PROGRAM What will be the value of A after executing.. Ans: 50 (since the A was not passed in USING clause) 21. 01 STATUS. 88 DIVORCED VALUE D. 88 WIDOWED VALUE W 88 MARRIED VALUE M 88 SINGLE VALUE S 88 VALID VALUES D,W,M,S MOVE W TO STATUS. Then one if condition with all condition check names and asked which para will be executed. Ans: the paraname under IF WIDOWED will be executed. 22. Instead of using FILE STAUTS = 10 what can be used. Ans: AT END clause 23. 1 other question with PERFORM where UNTIL condition is A=B A = 1 and incremented 1 by 1 B = 9 and unchanged. How many times the loop will be executed? Ans: 8 times. 24. If a file is opened in EXTEND MODE then

Ans: In Sequetial and Indexed file record are added at the end. 25. In what modes the WRITE operation can be done. Ans: OUTPUT and EXTEND. 26. For what RECORD KEY is used Ans: Used to access the primary key of the file. 27. 01 A OCCURS 5 TIMES 02 B X(1) VALUE 'H' Ans: HHHHH 28. One more size calculating question.

You might also like