I HAVE FOLLOWING DECLARATION.
02. A PIC X(10) VALUE 'XXXXXXXXXX'.
02. B REDEFINES A.
05. C PIC X(3).
05. D PIC X(3).
05. E PIC 9(3).
IN MY PROG, I HAVE
MOVE 1 TO E.
DISPLAY A.
WHAT WILL BE DISPLAYED AS A RESULT OF THIS?
PLEASE EXPLAIN THE ANSWER. THANKS.

Answers were Sorted based on User's Feedback



I HAVE FOLLOWING DECLARATION. 02. A PIC X(10) VALUE 'XXXXXXXXXX'. 02. B REDEFINES A. ..

Answer / duboisa

no you have
A = 'XXXXXX001X'

Is This Answer Correct ?    13 Yes 1 No

I HAVE FOLLOWING DECLARATION. 02. A PIC X(10) VALUE 'XXXXXXXXXX'. 02. B REDEFINES A. ..

Answer / duboisa

for me you have
c = 'XXX'
d = 'XXX'
e = 001
and A = 'XXXXXX001'

Is This Answer Correct ?    7 Yes 3 No

I HAVE FOLLOWING DECLARATION. 02. A PIC X(10) VALUE 'XXXXXXXXXX'. 02. B REDEFINES A. ..

Answer / garry

Correct answer is : (As already explained and corrected by Duboisa )

C = xxx
D = xxx
e = 001
So A = xxxxxx001x

100% assured!!

Any difference can be routed or discussed at : thespider390@hotmail.com

Is This Answer Correct ?    4 Yes 0 No

I HAVE FOLLOWING DECLARATION. 02. A PIC X(10) VALUE 'XXXXXXXXXX'. 02. B REDEFINES A. ..

Answer / paray2x

1. you will get data exception as you cannot move 'XXX' to
a 9(3) field.

2. Since you have not initialised C,D it will be '......001'

Is This Answer Correct ?    7 Yes 5 No

I HAVE FOLLOWING DECLARATION. 02. A PIC X(10) VALUE 'XXXXXXXXXX'. 02. B REDEFINES A. ..

Answer / smiley

Can anybody explain...How C and D are having values as "XXX"
in answer ,though not initialized. Purpose of redefines
clause is to use the same storage space for different data.
I think answer posted by PRANAY2X is correct.

Is This Answer Correct ?    2 Yes 2 No

I HAVE FOLLOWING DECLARATION. 02. A PIC X(10) VALUE 'XXXXXXXXXX'. 02. B REDEFINES A. ..

Answer / prasad

Thanks a lot for the help friends....

Is This Answer Correct ?    0 Yes 2 No

I HAVE FOLLOWING DECLARATION. 02. A PIC X(10) VALUE 'XXXXXXXXXX'. 02. B REDEFINES A. ..

Answer / anil

we cannot declare the group item with level no 02 it should
be declared with 01. so the question itself wrong

Is This Answer Correct ?    1 Yes 8 No

Post New Answer

More COBOL Interview Questions

What is the difference between Perform para and perform asaection in cobol?

3 Answers   TCS,


where will u code file status ?

2 Answers   TCS,


How do you do in-line PERFORM?

4 Answers   Accenture,


How do u initialize an array?

2 Answers   CTS,


01rec1. 05 a pic 999v99 value 123.12 05 b pic 99v9 value 45.9 02 rec2. 05 x pic 999v99 05 y pic 99v99 05 z pic x(3) value 'abc' if rec1 is moved to rec2 then what is the value of rec2?

5 Answers   Amdocs,






where do we use dyanamic call ? and where do we use static call pls give any example pls ?

3 Answers   Patni,


What is static and dynamic call in cobol?

0 Answers  


How do you reference the fixed block file formats from cobol programs

0 Answers  


consider the following progrm statements MOVE 0 TO SW.NO.OF.REC PERFORM PRI-OUT UNTIL SW=1 DISPALY NO.OF.REC STOP RUN PRE-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 displayedafter the PERFORM is over?assume that N0.OF.REC has PIC 9(4) a.1000 b.1001 c.1 d.none of the above since there is a syntex error

4 Answers   TCS,


What is an explicit scope terminator?

3 Answers  


Extract only those records from a PS file which are having word 'TEXT' in the records using COBOL? The word TEXT is not present in a particular position in all the records.

2 Answers   RBS,


What are decleratives in COBOL ?

1 Answers   Xansa,


Categories