Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL exam question
vsanker_at_yahoo.com wrote in message <8cq0ss$3hs$1_at_nnrp1.deja.com>...
>
>WHILE v_price < &&p_count LOOP
> v_amount:=v_amount + 1;
> v_price:=v_amount*&&p_pct_increase;
>END LOOP;
>
>If V_PRICE is 45, P_COUNT is 75, and V_AMOUNT is 5, which P_PCT_INCREASE
>value would cause the loop to terminate ?
In the previous loop itteration (from which the supplied values were given):
45 = 5 * pct_increase
p_pct_increase - 45 /5 = 9
But this tells us nothing about the p_pct_increase.
OK, for this loop itteration which must cause the loop to be terminated.
v_price (45) < p_count (75) : means that the loop is executed.
v_amount = 5 + 1 = 6
v_price = 6 x p_pct_increase
where v_price > p_count
p_count is 75, thus let us assume that v_price must be 76 in order to satisfy the greater than condition.
76 = 6 x p_pct_increase
p_pct_increase = 76 / 6 = 12.66667
Thus, any value of larger than a percentage increase of 12.6, will cause v_price to be larger than p_count.
>A. 0
>B. 15
>C. 20
>D. 45
>E. 75
B is the answer.
>I think it is 15 but the answer is 20.
Sez who? Assholes who can not program? Or do I have both my feet in my mouth and my leadpipe wrapped around my head with this one?
It seems to me that 15 is the right answer. Amount is 6 and you need to multiply it with a value that gives you a total that is larger than 75. Any integer from 13 up will give you that.
Billy Received on Mon Apr 10 2000 - 00:00:00 CDT