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

Hi................... I have records like this aaaa cccc bbbb And i want output like this bbbb cccc aaaa How can it possible ?. Note:Please make sure records are in unsorted order. somebody plzzz help me.

1 Answers  


Size of a column has been changed in DB2 table (Suppose it was of 5 characters and later changed to 4 characters) and forgot to change the DCLGEN in COBOL program, what will happen during the execution of code? If the program Abends then what will be the error? If it doesn't abend then hpw the error can be catched?

5 Answers   IBM,


what are the steps to sort in a cobol program?

2 Answers   Patni,


What is the difference between next sentence and continue in cobol programing language?

0 Answers  


how many bytes does s9(15) occupy in comp1 comp2 and comp3 ?

4 Answers   TCS,






what is record label is empty or standard in file description of data division?

2 Answers   HCL,


What should be the sorting order for SEARCH ALL?

5 Answers  


if we have a 10 steps how to override the 4th step in jcl?

2 Answers   Hewitt,


How do you do in-line PERFORM?

4 Answers   Accenture,


Consider the below example call a-test1. -- -- -- a-test1. if a=b perform a-test through a-exit next sentence else if b=c perform c-test through c-exit. if a=d perform d-test through d-exit. a-test. -- -- a-exit. exit. can u tell me what will happen if a=b after looping into a-exit will the control go back to a- test1. will the condition a=d be checked???

5 Answers   IBM,


What will happen if we move SPACES to numeric field and ZEROES to alphabetic field?

2 Answers  


Write a program to enter and display the names of students in a class using the occurs clause.

0 Answers  


Categories