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

can we use go to statement inline-perform?

7 Answers   IBM,


what are difference organizations in cobol and access mode in cobol? can you expalin what organization means while declaring for ksds,esds,rrds?

1 Answers   HCL,


i made it to stage 3 of an interview process wednessday they will quiz my knowledge again face to face for an analyst role recruiter said it will be based on Business requirements system is cobol and good ideas what they might ask etc

0 Answers  


if a dataset is already created with fixed length but after that i want to change fixed length to variable length then how is it possible

3 Answers   IBM,


write a program to eliminate duplicate records in a input file and send them to output file.THIS IS IGATE RECENT QUESTIONN.....JUST 1 WEEK BACKKKK...

5 Answers   iGate,






What is the difference between SEARCH and SEARCH ALL? What is more efficient?

9 Answers   IBM, iFlex, Wipro,


IF there 5 to 6 files in a JCL and there is some space abends, how can we identify which file has space abend and what can be done to get off that abend or rectify that abend.

2 Answers   ADNA, CSC,


I have a source program compiled with Cobol-2. The output file has a record length of 100 defined in the program but a record of 60 bytes getting written into it. i.e. The rest of 40 bytes I am not Writing anything. But it by default puts some values into the last 40 bytes. However it does not impact anything. But when Compiled the module with Enterprise Cobol the last 40 bytes were spaces as fillers. Can anyone explain?

5 Answers   Cognizant,


Which mode is used to operate the sequential file?

0 Answers  


is it possible to declare index in cobol program? if it is not why its tell me pls

3 Answers  


In the JCL, how do you define the files referred to in a subroutine ?

2 Answers  


How do you define a variable of COMP-1? COMP-2?

3 Answers  


Categories