Consider the following COBOL entries
05 X PIC 99 VALUE 10.
ADD 40 X TO X.
COMPUTE X = 3 * X - 40.
The result in X is

Answers were Sorted based on User's Feedback



Consider the following COBOL entries 05 X PIC 99 VALUE 10. ADD 40 X TO X. COMPUTE X = 3 * X - ..

Answer / muhammad abdul aleem

I doubt if 05 level number will work or not.
But if it works the here is the answer.

Add 40,x to x means X = 10 + 40 + 10 =60
then
x = 60*3 -40
x=180-40
= 140

Since X = 99 so value will be 40
Therefore, Value of X will be 40...

Is This Answer Correct ?    26 Yes 0 No

Consider the following COBOL entries 05 X PIC 99 VALUE 10. ADD 40 X TO X. COMPUTE X = 3 * X - ..

Answer / rama krishna

Answer is again 10.

Add 40 to x :
x + 40 : 10 + 40 = 50

X = 3*X - 40
3 * x = 50 * 3 = 150, but since x declared as PIC 99, 1
will be truncated from 150. so now the value of x would be
50. so 50 - 40 is again 10.

Is This Answer Correct ?    22 Yes 6 No

Consider the following COBOL entries 05 X PIC 99 VALUE 10. ADD 40 X TO X. COMPUTE X = 3 * X - ..

Answer / varun v

I agree with Ans #4. I also checked the same..Value of X
will be 40...


Please please verify it thouroughly before publishing the
answers...Wrong answers will mislead people..

Is This Answer Correct ?    4 Yes 1 No

Consider the following COBOL entries 05 X PIC 99 VALUE 10. ADD 40 X TO X. COMPUTE X = 3 * X - ..

Answer / neelam

I agree with all of them who have answered 40.
It is a simple statement in cobol that

ADD A B TO C. (Means (A+B)+C moved in C)

Here,
ADD 40 X TO X ()

Value of X is 10
So, ADD 40 10 TO 10 (Gives 40+10+10 = 60)


Now, COMPUTE X = 3 * X - 40
Means X = 3 * 60 - 40 (Gives 180 - 40 = 140 )

Since PIC clause for X is 99, hence 140 can't be store in
variable X.

So answer is : 40

Is This Answer Correct ?    3 Yes 0 No

Consider the following COBOL entries 05 X PIC 99 VALUE 10. ADD 40 X TO X. COMPUTE X = 3 * X - ..

Answer / akhilesh

FRIENDS HAVE ATTENTION

DIRECTLY CODING 05 LEVEL ENTRY WILL SHOW ERROR

Is This Answer Correct ?    2 Yes 1 No

Consider the following COBOL entries 05 X PIC 99 VALUE 10. ADD 40 X TO X. COMPUTE X = 3 * X - ..

Answer / ram g

compiler wont support 05 level direct coding ..assuming
that its a 01 level .. ans is 40.

Is This Answer Correct ?    3 Yes 2 No

Consider the following COBOL entries 05 X PIC 99 VALUE 10. ADD 40 X TO X. COMPUTE X = 3 * X - ..

Answer / kumar l

ADD 40 X to X means : 40+X will add to X and result will
be stored in X - Result is 60
Compute X = 3 * X - 40 means : 3*60-40 = 140.
So X value is 140.

Is This Answer Correct ?    5 Yes 6 No

Consider the following COBOL entries 05 X PIC 99 VALUE 10. ADD 40 X TO X. COMPUTE X = 3 * X - ..

Answer / suputhru

I agree with Rama Krishna ans: 10

05 X PIC 99 VALUE 10.
ADD 40 X TO X. ----------- x=x+40 x=10+40 x=50
COMPUTE X = 3 * X - 40.------x=(3*50)-40 x=150-40 x=110 since x pic 99--


finally x=10

antheeeeeeeee.

Is This Answer Correct ?    1 Yes 2 No

Consider the following COBOL entries 05 X PIC 99 VALUE 10. ADD 40 X TO X. COMPUTE X = 3 * X - ..

Answer / geetanjali

ADD 40 X TO X
***********ADD 40 10 TO X
***********X=X+40+10=60
***********COMPUTE X=3*60-40=120
X=120

Is This Answer Correct ?    0 Yes 1 No

Consider the following COBOL entries 05 X PIC 99 VALUE 10. ADD 40 X TO X. COMPUTE X = 3 * X - ..

Answer / ssampath

110

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More COBOL Interview Questions

input= ,,,, mainframe training ,,, hyderabad .... location.... output1=$ mainframe training in hyderabad location$ output2=**** mainframe training in hyderabad location ****. In this pgn when we give input considering the spaces the output is displayed in this format.Like in the place of ,,,, $ should be displayed likewise.So please helpmeout.

0 Answers  


How many times the loop runs here 01 a pic 9(2) value 10. perform para1 a times stop run. para1: move 20 to a.

3 Answers  


How to delete a front spaces in a data-name/variable in cobol Example:- 01 data-name-1 PIC x(20) value " cobol language". 01 data-name-2 PIC x(20). MOVE data-name-1 to data-name-2. would like the value of data-name-2 is "cobol language".

3 Answers  


in cobol main pgm is calling sub pgm but sub pgm does not exists , what abend i get if submit the job?

2 Answers   HSBC,


I have a Main Program which is calling Sub-Program which is a DB2 pgm. What will happen if I am not closing the cursor used in the Sub-program? Please advise..

3 Answers   iGate,






which is better either static call or dynamic call? and why?

5 Answers   HCL,


What guidelines should be followed to write a structured cobol prgm?

0 Answers  


How to replace the GOTO statement in COBOL without changing the structure of program. e.g. consider following code... I.D. E.D. D.D. P.D. compute C = A + B. GOTO para 100-display. compute D = C - D. GOTO 200-display. some other logic...... ........ GOTO 300-para. ...... ...... GOTO 400-para. Now I want to replacce all GOTO statements without changing the structure and otput of program.

6 Answers   Accenture,


PERFORM ACCUMULATE-TOTALS VARYING A FROM 1 BY 2 UNTIL A >2 AFTER B FROM1 BY 1 UNTIL B>2 AFTER C FROM 2 BY -1 UNTIL C<2 How many times the paragraph ACCUMULATE-TOTALS would be exicuted?

5 Answers   TCS,


77 a pic x(4) value '1234' -----> instead of this 'abcd' 77 b pic 9(4) value zeros. move a to b what is the answers for both cases? IS it possible? Give me elementary move rules briefly......

8 Answers  


How can i write a comp-3 variable into a sequential file should i declara the field in the file description as comp- 3?

1 Answers  


Describe the cobol database components?

0 Answers  


Categories