‎2007 Nov 29 10:51 AM
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
‎2007 Nov 29 10:52 AM
‎2007 Nov 29 10:52 AM
‎2007 Nov 29 10:54 AM
‎2007 Nov 29 11:28 AM
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
‎2007 Nov 29 4:00 PM
And you couldn't figure this on your own by taking a simple piece of paper and a pencil?
‎2007 Nov 29 4:08 PM
hahahhaha what kind of a programmer are you who can't figure out logic?
‎2007 Nov 30 6:55 AM
SAMEER SIR.........
IF U DON'T KNW THE ANS , JUST KEEP QUITE...OK
‎2007 Nov 30 8:23 AM
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
‎2007 Nov 30 8:33 AM
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.
‎2007 Nov 30 7:09 AM
‎2007 Nov 30 8:32 AM
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.