Consider the following:

77 W-NUM PIC 9 VALUE 0
------
MOVE 1 TO W-NUM
PERFORM PARA-X UNTIL W-NUM > 9.
------
PARA-X
ADD 1 TO W-NUM

How many times PARA-X is executed ?

Answers were Sorted based on User's Feedback



Consider the following: 77 W-NUM PIC 9 VALUE 0 ------ MOVE 1 TO W-NUM ..

Answer / rahul

as the variable W-NUM is single digit (PIC 9), it will
never be greater than 9. Hence the loop will be infinite.

Is This Answer Correct ?    13 Yes 1 No

Consider the following: 77 W-NUM PIC 9 VALUE 0 ------ MOVE 1 TO W-NUM ..

Answer / thrivikram

it goes into infinite loop.

when w-num =9 , it will become 0

Is This Answer Correct ?    10 Yes 1 No

Consider the following: 77 W-NUM PIC 9 VALUE 0 ------ MOVE 1 TO W-NUM ..

Answer / hemanth reddy

Sorry i thought that it is < 9 .
If it is less than 9 it is correct.
If it is > 9 then it goes to infinite loop

Is This Answer Correct ?    8 Yes 0 No

Consider the following: 77 W-NUM PIC 9 VALUE 0 ------ MOVE 1 TO W-NUM ..

Answer / ram.g

sorry for my wrong ans..

it will be in the infinite loop...

should use different ws variables..

Is This Answer Correct ?    4 Yes 1 No

Consider the following: 77 W-NUM PIC 9 VALUE 0 ------ MOVE 1 TO W-NUM ..

Answer / mr.perfect

9 times.
Initially, W-Num value will be 1.
1>9, so para will be executed. - 1 time
2>9, so para will be executed. - 2 times
3>9, so para will be executed. - 3 times
4>9, so para will be executed. - 4 times
5>9, so para will be executed. - 5 times
6>9, so para will be executed. - 6 times
7>9, so para will be executed. - 7 times
8>9, so para will be executed. - 8 times
9>9, so para will be executed. - 9 times
10>9, this will go to 0 because , the PIC at WOrking
storage section is 9. so that 10 becomes 0
W-NNum = 0 . THe loop again start from 0> 9
this will execute Infinite loop.

Is This Answer Correct ?    3 Yes 1 No

Consider the following: 77 W-NUM PIC 9 VALUE 0 ------ MOVE 1 TO W-NUM ..

Answer / guest

it will go in a infinite loop. But simply because
when W-NUM is 9, after "ADD 1 TO W-NUM", W_NUM would again
become 0.

Is This Answer Correct ?    0 Yes 0 No

Consider the following: 77 W-NUM PIC 9 VALUE 0 ------ MOVE 1 TO W-NUM ..

Answer / avinanda mukherjee

Thrivikram is absulately correct....

Avinanda Mukherjee

Is This Answer Correct ?    2 Yes 3 No

Consider the following: 77 W-NUM PIC 9 VALUE 0 ------ MOVE 1 TO W-NUM ..

Answer / gaurav

Rahul's answer is correct.

Please note that the W-NUM is defined as PIC 9, hence it
can contain only a single digit numberic number i.e from
number 0 to number 9. Thus when the PARA-X is executed 9
times when W-NUM contains 9. It will not be able to add
further 1 to W-NUM, thus it will go in a infinite loop.

Hope this clear things.

Is This Answer Correct ?    0 Yes 1 No

Consider the following: 77 W-NUM PIC 9 VALUE 0 ------ MOVE 1 TO W-NUM ..

Answer / vel

9

Is This Answer Correct ?    5 Yes 7 No

Consider the following: 77 W-NUM PIC 9 VALUE 0 ------ MOVE 1 TO W-NUM ..

Answer / hemanth reddy

It will execute 8 times.
Because Initially w_Num is 1 By checking 1 > 9 it will
execute the para-x and adding 1 to W-NUM

Is This Answer Correct ?    2 Yes 4 No

Post New Answer

More COBOL Interview Questions

Which mode is used to operate the sequential file?

0 Answers  


where did you see the information regarding abend codes in jcl?

1 Answers   Hewitt,


How to define variable 9(20) in COBOL, because compiler does not allow us to declare variables with Pic 9(18). Can anyone please let me know the answer... I know one answer to this question which is to use Compiler option Arith (Extend) during Compilation. It extends the maximum limit to 9(32)..Just wanted to know if there is any other way to extend this?

4 Answers   CSC, TCS,


What is the maximum length of a field you can define using COMP-3 in COBOL?

1 Answers   UGC Corporation,


How to resolve the soc4 & soc7 other than following answers. Soc4 can resolved using mispleed dd name and dd name is not matching with file and soc7 check the sysdump and copy the offest address then correct it in the program.

10 Answers   ADP, Amdocs, Cap Gemini, Keane India Ltd, Super Value, TCS,






wht is the use of evalute verb ? how do u declare recfm in cobol and jcl ?

2 Answers   EDS,


How do get the result of your program directly on your pc?

0 Answers   UST,


input 1 input2 ouput1 output2 output 3 1 re 300 1 re 200 1 re 300 3 rc 500 1 re 200 2 rr 400 1 re 300 2 rr 400 1 rc 400 3 rc 500 1 rc 400 2 rr 700 2 rr 700 5 tt 900 5 tt 900 2 inputs r in flat file and output 1 is matched records,ouptput2 is unmatched of input1,output3 is unmatched of input2! how vl u get the output files using sequential order and to check with each and every records! let me know the procedure division ?

0 Answers  


How will 128 be saved in s9 (3) comp-3 How will 12 be saved in s9 (2) comp

3 Answers   CTS,


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

5 Answers   HCL,


What is Control Break processing ?

1 Answers   iGate,


consider the following PROCEDURE DIVISION entry OPEN EXTEND IN-FILE identify the correct statement a.organization of IN-FILE is sequential and records can be added in the beginning b.organization of IN-FILE is sequential and records can be added in the end c.organization of IN-FILE is indexed and records can be added in the beginning d.organization of IN-FILE is indexed and records can be added in the end

3 Answers   TCS,


Categories