Application Development and Automation 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: 
Read only

Help me

Former Member
0 Likes
1,300

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
Read only

Former Member
0 Likes
1,267

ans isd 12

10 REPLIES 10
Read only

Former Member
0 Likes
1,268

ans isd 12

Read only

Former Member
0 Likes
1,267

D

Read only

Former Member
0 Likes
1,267

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

Read only

Former Member
0 Likes
1,267

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

Read only

Former Member
0 Likes
1,267

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

Read only

0 Likes
1,267

SAMEER SIR.........

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

Read only

0 Likes
1,267

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

Read only

0 Likes
1,267

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.

Read only

Former Member
0 Likes
1,267

Hi

ANS: D---> 12.

thanks,

s.suresh.

reward if useful.

Read only

Former Member
0 Likes
1,267

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.