Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Help me

Former Member
0 Kudos

Data: number type i.

while number < 10.

Add 1 to number.

If number < 8.

Continue.

Else.

Add 4 to number.

Endif.

Endwhile.

Write number.

What does NUMBER equal after executing the above code?

a) 4

b) 8

c) 10

d) 12

e) 14

1 ACCEPTED SOLUTION

Former Member
0 Kudos

ans isd 12

10 REPLIES 10

Former Member
0 Kudos

ans isd 12

Former Member
0 Kudos

D

Former Member
0 Kudos

d) 12

WHILE number < 10.
  ADD 1 TO number.
  IF number < 8.
    CONTINUE.
  ELSE.
    ADD 4 TO number.
  ENDIF.
ENDWHILE.

1º while step:

number: 0 + 1

2º while step:

number: 1 + 1

3º while step:

number: 2 + 1

4º while step:

number: 3 + 1

5º while step:

number: 4 + 1

6º while step:

number: 5 + 1

7º while step:

number: 6 + 1

8º while step:

number: 7 + 1 + 4

number = 12 --> endwhile

Former Member
0 Kudos

And you couldn't figure this on your own by taking a simple piece of paper and a pencil?

Former Member
0 Kudos

hahahhaha what kind of a programmer are you who can't figure out logic?

0 Kudos

SAMEER SIR.........

IF U DON'T KNW THE ANS , JUST KEEP QUITE...OK

0 Kudos

Well if you don't know the answer either (which is obvious from your question), why don't you try and find it out yourself instead of disguising test questions as challenges?

Bye,

Sameer

0 Kudos

certification questions are forbidden in this forum you should repect THAT.

besides: having problems with such an easy task may give you a hint that you maybe better off in something not too complex.

Former Member
0 Kudos

Hi

ANS: D---> 12.

thanks,

s.suresh.

reward if useful.

Former Member
0 Kudos

As others have said, the answer is 12, assuming there is no other code between the data declaration and the code, ie assuming number = 0 when the code is executed.