COBOL Interview Questions -1



COBOL Interview Questions -1

Postby Ravi Teja » Fri Dec 03, 2010 11:27 am

IF I AM INCORRECT,PLZ CORRECT ME...


(1) Index in Cobol is defined as _______

a) Array occurence
b) Displacement from begining of Array
c) It is sequentially accessible
d) Not for Random process



(2) Study the following :
01 A PIC 99v0 value 5.
01 B PIC 9V9 VALUE 6.
01 C PIC 99V9 VALUE 2.8.
01 D PIC 99 VALUE 3.
COMPUTE A ROUNDED B C = A + B * C / D


a) A=11,B=0.6,c=10.6
b) A=10,B=0.6,C=10.6
c) A=11,B=0,C=10
d) A=10,B=6,C=10


(3) Which of the following statements will not indicate duplicate key warning if it occurs in case of an indexed organisation without DUPLICATES Phrase

a) Read
b) Write
c) Rewrite
d) Delete


(4) What will happen if you code GO BACK instead of STOP RUN in a standalone COBOL program i.e. a program which is not calling any other program?

a) Shows Error
b) Nothing happened
c) Return to previous step
d) Infinite Loop


(5) In packed decimal number +2431 how would be stored?

a) +2431f
b) 02431f
c) 02431
d) +2431


(6) Just one -------- statement allows several alternative paths of execution

a) evaluate
b) if statements
c) perform statement
d) copy statement



(7) Given the following Data Division Entries :
01 T1.
03 N PIC 99.
03 T2.
04 M OCCURS 1 TO 20 DEPENDING ON N. 05 P PIC XX.
Indicate which one of the following is incorrect?


a) T1 will have variable size.
b) m will have variable no of occurences
c) T2 will have variable size.
d) The above description is wrong


(8) How many bytes will comp-2 occupy?

a) 8 bytes
b) 4 bytes
c) 16 bytes
d) 24 bytes


(9) How can you reference an element of a 3 dimensional table?

a) 2 indexes
b) Subscripts
c) Search
d) Search-all


(10) Identify the Syntax error in the following :
01 B pic A(7).
02 C PIC 9(4).
.....................
IF(B NUMERIC)
ADD 10 TO C.


a) condition in the if statement is wrong.
b) nothing is wrong
c) C is initialized,Add 10 TO C is wrong.
d) both b and c should have the same size


(11) Temp files can be defined as

a) DSN=&&TEMP
b) DSN=&TEMP
c) DSN=&&XYZ
d) BOTh a) and c) are true


(12) What do you mean by file status 37.

a) File attribute mismatch
b) file logically error
c) Open specified on the file that doesn’t support open mode.
d) File opened in write mode


(13) How is sign stored in Packed Decimal fields?

a) Sign is stored as a hex value in the last nibble (4 bits ) of the storage
b) Sign is over punched with numeric value stored in the last bite
c) Sign is stored in hex value in first 4 bits of storage
d) None of the above



(14) Consider the following two statements
MOVE 10 TO N.
PERFORM PARA-X N TIMES
STOP RUN.
PARA-X.
MOVE 5 TO N. How many times PARA-X will be executed?


a) 10
b) 05
c) Infinite
d) Execution Error


(15) How do you set a return code to the JCL from a COBOL program

a) By moving a value to RETURN-CODE reg
b) By moving a value to RETURN_CODE
c) By moving a value to RCODE
d) By moving a value to RETURNCODE


(16) Indicate which one of the following is not true about the SET verb.

a) The verb can be used to set one or more indexes to a particular value
b) The verb can be used to move the current value of an index to one or more identifiers
c) The verb can be used to increment one or more identifiers by a positive integral value.
d) The verb can be used to decrement one or more indexes by a positive integral value.


(17) PERFORM ACCULATE-TOTALS VARYING A FROM 1 BY 2 UNTIL A > 2 AFTER B FROM 1 BY 1 UNTIL B > 2 AFTER C FROM 2 BY -1 UNTIL C < -9 How many times accumulate-totals will be executed?

a) 10
b) 09
c) 11
d) infinite loop.


(18) How many times PARA-A is performed
PERFORM PARA-A VARYING TIMES-COUNTER FROM 1 BY 1 UNTIL TIMES-COUNTER > 0.
STOP RUN.
PARA-A.
SUBTRACT 1 FROM TIMES-COUNTER.
DISPLAY “HAI”.


a) 10
b) infinite loop
c) 2
d) 0


(19) Consider the following:

77 W-NUM PIC 9 VALUE 0.
----------------
MOVE 1 TO W-NUM
PERFORM PARA-X UNTIL W-NUM ] 9.
- ------------
PARA-X.
ADD 1 TO W-NUM

How many times PARA-X will execute?


a) 12
b) 10
c) 09
d) Infinite Loop


(20) Indicate what value will be displayed after the execution of the DISPLAY statement in the paragraph named P3.
MOVE 2 to M.
P1.
PERFORM P2 9 TIMES.
P2.
MULTIPLY 2 BY M.
P3.
DISPLAY M


a) 2048
b) 2036
c) 1048
d) None of the above


(21) What is the compiler option to show line where the error occurred?

a) ARITH(EXTEND)
b) TEST
c) RENT
d) ARITH(COMPAT)


(22) Consider the following program statements
MOVE 0 TO SW.
PERFORM PRI-OUT UNTIL SW=1
DISPALY NO-OF-REC
STOP RUN
PRI-OUT.
READ IN-FILE AT END MOVE 1 TO SW.
WRITE OUO-REC FROM IN-REC.
ADD 1 TO NO-OF-REC.

if the IN-FILE contains 1000 records what value will be displayed after the PERFORM is over? assume that NO-OF-REC has PIC 9(4)


a) 1000
b) 1001
c) 1
d) None of the above


(23)
77 WA PIC 9(3)V99 VALUE 23.75
77 WB PIC ZZ9V99 VALUE 123.45
After MOVE WA TO WB The contents of WB will be ?


a) b2375 ( b indicates space )
b) 023.75
c) b23.75 ( b indicates space )
d) None of the above


(24) The ---- Statements has always allowed you to develop program functions that can be stored seperately from other program code and then be included in the program at

a) Perform and Evaluate
b) copy and perform
c) call and perform
d) Copy and call



(25) Identify the incorrect statement

a) CALL MY-SUB
b) CALL MY-SUB ON OVERFLOW GO TO PARA1.
c) CALL MY-SUB USING PARM-1.
d) CALL MY-SUB USING PARM-1 UNTIL PARM-1=10
Thank You
Ravi Teja
 
Posts: 15
Joined: Fri Dec 03, 2010 11:22 am
Has thanked: 0 time
Been thanked: 0 time

Re: COBOL TEST-1 ANS

Postby Robert Sample » Fri Dec 03, 2010 6:28 pm

2. Variable A has a syntax error and the code as provided will not compile.

4. Your answer is wrong -- GOBACK and STOP RUN are equivalent statements in a standalone program.

5. NONE of the answers are right. X'02431C' is the right answer. If the number was unsigned, X'02431F' would be correct -- but the C in the sign means +, whereas F means unsigned (default positive).

7. The definition is right -- so your answer is wrong. B is the answer they're looking for, since T1 will not be variable length if it is in WORKING-STORAGE.

12. Answer C is correct.

13. Answer A is correct.

15. Answer A is correct.

17. None of the answers is correct.

19. Syntax error in UNTIL W-NUM ] 9 If this is supposed to be > 9, then W-NUM, as a single byte variable, cannot ever, under any circumstances, have a value larger than 9.

22. What was the initial value of NO-OF-REC?

23. Answer A is correct -- V in a PICTURE is implied decimal point and never appears in the data.

25. Answer D is correct.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: COBOL TEST-1 ANS

Postby Ravi Teja » Sat Dec 04, 2010 12:44 pm

Thank you, Robert

Here are correction of some above questions...


(2) Study the following :
01 A PIC 99v9 value 5.
01 B PIC 9V9 VALUE 6.
01 C PIC 99V9 VALUE 2.8.
01 D PIC 99 VALUE 3.
COMPUTE A ROUNDED B C = A + B * C / D


a) A=11,B=0.6,c=10.6
b) A=10,B=0.6,C=10.6
c) A=11,B=0,C=10
d) A=10,B=6,C=10


(17) PERFORM ACCULATE-TOTALS VARYING A FROM 1 BY 2 UNTIL A > 2
AFTER B FROM 1 BY 1 UNTIL B > 2 AFTER C FROM 2 BY -1 UNTIL C > -9
How many times accumulate-totals will be executed?


a) 10
b) 09
c) 11
d) infinite loop.


(19) Consider the following:
77 W-NUM PIC 9 VALUE 0.
----------------
MOVE 1 TO W-NUM
PERFORM PARA-X UNTIL W-NUM > 9.
- ------------
PARA-X.
ADD 1 TO W-NUM
How many times PARA-X will execute?


a) 12
b) 10
c) 09
d) Infinite Loop


(22) Consider the following program statements
MOVE 0 TO SW.
PERFORM PRI-OUT UNTIL SW=1
DISPALY NO-OF-REC
STOP RUN
PRI-OUT.
READ IN-FILE AT END MOVE 1 TO SW.
WRITE OUO-REC FROM IN-REC.
ADD 1 TO NO-OF-REC.

if the IN-FILE contains 1000 records what value will be displayed after the PERFORM is over?
assume that NO-OF-REC has PIC 9(4) and initial value of NO-OF-REC is 0(zero)


a) 1000
b) 1001
c) 1
d) None of the above


If in correct correct, me
Thank You
Ravi Teja
 
Posts: 15
Joined: Fri Dec 03, 2010 11:22 am
Has thanked: 0 time
Been thanked: 0 time


Return to Interview Questions

 


  • Related topics
    Replies
    Views
    Last post