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?

Answers were Sorted based on User's Feedback



PERFORM ACCUMULATE-TOTALS VARYING A FROM 1 BY 2 UNTIL A >2 AFTER B FROM1 BY 1 UNTIL B&g..

Answer / shakilaashwin

PERFORM ACCUMULATE-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<2.

ACCUMULATE-TOTALS.
ADD 1 TO ACCUMULATE-CNT.
DISPLAY 'A - ' , A.
DISPLAY 'B - ' , B.
DISPLAY 'C - ' , C.


Ans is 2 - The loop will be executed until all the condition
(A > 2, B > 2, C < 2) becomes True.

Execution : 1 Condition is
A - 1 True
B - 1 True
C - 2 False

Execution : 2
A - 1 False
B - 2 True
C - 2 False

When going for 3rd execution - No condition Will be True

Is This Answer Correct ?    6 Yes 2 No

PERFORM ACCUMULATE-TOTALS VARYING A FROM 1 BY 2 UNTIL A >2 AFTER B FROM1 BY 1 UNTIL B&g..

Answer / vel

2 times

Is This Answer Correct ?    2 Yes 0 No

PERFORM ACCUMULATE-TOTALS VARYING A FROM 1 BY 2 UNTIL A >2 AFTER B FROM1 BY 1 UNTIL B&g..

Answer / guy

2 times.But how

Is This Answer Correct ?    1 Yes 0 No

PERFORM ACCUMULATE-TOTALS VARYING A FROM 1 BY 2 UNTIL A >2 AFTER B FROM1 BY 1 UNTIL B&g..

Answer / shan

looping happens for following values of
A, B, C
1, 1, 2 = 1st
1, 2, 2 = 2nd
2, 1, 2 = 3rd
2, 2, 2 = 4th

So totally four times this will get executed

Is This Answer Correct ?    2 Yes 3 No

PERFORM ACCUMULATE-TOTALS VARYING A FROM 1 BY 2 UNTIL A >2 AFTER B FROM1 BY 1 UNTIL B&g..

Answer / shailendra

i think it will work once

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More COBOL Interview Questions

Sending data is aplhabetic size 7 (value 3000), I wantated this value to be stored in database, which is defined as s9(7)v9(2)comp-3.

2 Answers  


which is better comp or comp-3 in terms of memory utilization?

6 Answers  


which one is better among static call and dynamic call?

3 Answers  


) How do you access the migrate the data from production region to development region

1 Answers   IBM,


When can the USING phrase be included in the call statement ?

2 Answers  






what are the diferences b/w sub-script and index?

4 Answers  


Differentiate between structured cobol programming and object-oriented cobol programming.

0 Answers  


How to covert given string into ASCII value in COBOL/MF COBOL

3 Answers   CTS, IBM, iFlex,


What is the difference between CONTINUE & NEXT SENTENCE ?

2 Answers  


What is the Purpose of Pointer in the string?

0 Answers  


What care has to be taken to force program to execute above 16 Meg line?

1 Answers  


study the following 01 A PIC 99V0 VALUE 5 01 B PIC 9V9 VALUE 6 01 C PIC 99V9 VALUE 2.5 01 D PIC 99 VALUE 3 COMPUTE A ROUNDED B C = A+B*C/D ON SIZE ERROR PERFORM PRINT-ERROR the comments of A.B.C after execution of the above statement are a.A=10 B=0 C=10 b.A=10 B=9.9 C=9.9 c.A=10 B=0 C=9.9 d.A=10 B=6 C=10

4 Answers   TCS,


Categories