※ Our check while writing this explanation could not fully confirm the published answer; scoring follows IPA's official key.
×Incorrectア
d=54,000 is correct, but e=54,000 is wrong. In Test 4, K=30 violates the purchase condition that at most 20 child tickets, too, can be bought at one time. The function gets No at the first condition check (0≦J≦20 and 0≦K≦20), never enters the amount-calculation branch at all, and returns L=−1. The value 54,000 appears only if you skip the condition check, compute 3,000×10+1,000×30=60,000, and then multiply by 0.9 because J+K=40≧20; it is a mistake that ignores the purchase-condition test.
○イ
正解The correct answer is イ (d:54,000, e:−1). Following the [Processing details] of question group B, this function works in this order: (1) first check the purchase conditions, (2) calculate the total amount only when the conditions are met, and (3) take 10% off when 20 or more tickets are bought in total. The purchase condition is that at most 20 adult tickets and at most 20 child tickets can be bought at one time, that is, 0≦J≦20 and 0≦K≦20; if this is not satisfied, the function does not calculate any amount but assigns −1 to L and ends. When the condition is satisfied, it computes L=3,000×J+1,000×K, and then takes 10% off, that is, multiplies by 0.9, only when J+K≧20. First, check this calculation model against the known Test 1: J=3 and K=2 are both 20 or less, so the condition is met; J+K=5 is less than 20, so there is no discount, and L=3,000×3+1,000×2=9,000+2,000=11,000, which matches the value in Table 2. Next, find d. In Test 2, J=15 and K=15 are both 20 or less, so the purchase condition holds; J+K=30 is 20 or more, so the discount applies, and L=0.9×(3,000×15+1,000×15)=0.9×(45,000+15,000)=0.9×60,000=54,000. Therefore d=54,000. Then find e. In Test 4, J=10 is 20 or less, but K=30 exceeds the upper limit of 20 tickets, so it does not meet the purchase condition of at most 20 tickets each for adults and children. In this case the flow never enters the amount-calculation branch; under [Processing details] (1) it assigns −1 to L and ends, so e=−1. Only イ has the combination d=54,000 and e=−1, so イ is the correct answer. Confirming that −1 is returned in an abnormal case that fails the conditions, as in Test 4, is also an important role of test data.
×Incorrectウ
Both d and e are wrong. d=60,000 is the value obtained by stopping at the pre-discount amount 3,000×15+1,000×15=60,000 for Test 2 (J=15, K=15). Since J+K=30 is 20 or more, the 10% reduction in [Processing details] (3) is certainly applied, so the correct expected result must be 0.9×60,000=54,000. e=54,000 is wrong for the same reason as ア: in Test 4, K=30 exceeds the upper limit, so the flow does not reach the amount calculation and L=−1.
×Incorrectエ
e=−1 is correct, but d=60,000 is wrong. In Test 2, J=15 and K=15 are both 20 or less, so the purchase condition is met and the total amount comes to 3,000×15+1,000×15=60,000. But that is not the end: there is a rule that when 20 or more tickets are bought in total, 10% is taken off the total amount, and J+K=30 is 20 or more, so the discount applies. The expected result is therefore not 60,000 but 0.9×60,000=54,000. 60,000 is merely the value obtained by forgetting to apply the discount step.
ここがポイント
The expected result (expected value) for test data must be worked out by yourself by tracing the processing according to the specification, not according to the implementation. For the function in this question, the decisive point is the order of the branches: check the purchase conditions (0≦J≦20 and 0≦K≦20) → if not met, L=−1; if met, compute the total amount L=3,000×J+1,000×K → then, if J+K≧20, take 10% off (×0.9). Keep to that order and d=54,000 and e=−1 are determined mechanically.
How to cover boundary values and abnormal cases — going over the limit of 20 tickets by even one (for example K=30) means the amount calculation is skipped and the error value −1 is returned, while exactly 20 tickets in total still gets the discount because J+K≧20. Deliberately preparing test data aimed at such boundaries and exceptions is a basic of test design. Verifying the calculation model with the known Test 1 (J=3, K=2 → 11,000) before filling in the unknown cells prevents mistakes such as forgetting to multiply by the discount.