Skip to content

平成22年度 秋期 ITパスポート試験 問92

This question's explanation and your answers so far.

問92
頻出度★★★

M さんは,総務課の N さんから宅配荷物の発送業務で利用する料金計算プログラム(以下,プログラムという)の作成を依頼された。そこで,N さんから聞いた料金計算の方法を基に次のように要件をまとめ,プログラムを作成した。 (1) 料金はサイズ区分と発送先の地区から表1の料金表で求める。サイズ区分は荷物の3辺計(荷物の縦,横,高さの長さの合計で1cm単位)と重量(1kg単位)を比較し,どちらか大きい方の区分を適用する。 なお,3辺計が140cm又は重量が20kgを超える荷物は受け付けない。 (2) 荷物の3辺計と重量,発送先の地区(A~D)を入力すると,料金を出力する。 表1 料金表(単位 円)

区分3辺計(cm)重量(kg)ABCD
180まで5まで1,3009501,1501,800
2100まで10まで1,6001,2001,4002,350
3140まで20まで2,0001,6001,8003,400

M さんは,プログラムを N さんに引き渡す前にテストを行うことにした。 テストに当たり,表2の出力結果表を作成し,これに基づいてテストデータを準備した。表2は,入力データが各列に示す Yes の組合せに該当する値であるときの正しい出力を,欄“予想出力”に記入したものである。 表2 出力結果表

123456…36
地区AYesYesYesYesYesYes…
B…
C…
D…Yes
3辺計(cm)80までYesYesYes…
100までYesYesYes…
140まで…Yes
重量(kg)5までYesYes…
10までYesYes…
20までYesYes…Yes
予想出力(円)a…
↑ b↑ c

注 網掛けの部分は,表示していない。 表2の出力結果表のb,cで示すそれぞれの列のテストデータ(地区,3辺計,重量)の組合せとして,適切なものはどれか。

出典 平成22年度 秋期 ITパスポート試験 問92
解説

問 92

  • Incorrectア

    The mistake is setting the 3-dimension total to 80 cm. 80 falls in the “up to 80” row, so it corresponds neither to column b (3-dimension total = up to 100) nor to column c (also up to 100). In fact, b's (A, 80, 10) is the test data for column 2 and c's (A, 80, 20) is the test data for column 3 (the column of a), so both are shifted one size-category block (three columns) to the left. By the convention of Table 2, the boundary value 80 is read as belonging to the “up to 80” side, not to “up to 100”.

  • イ

    正解 The correct answer is イ. First, pin down which columns of Table 2 b and c are. From the arrows in the figure, b is column 5 and c is column 6, and the Yes marks are: for b, “District = A / 3-dimension total = up to 100 / Weight = up to 10”, and for c, “District = A / 3-dimension total = up to 100 / Weight = up to 20”. The important point here is that the 3-dimension-total rows and the weight rows in Table 2 are mutually exclusive ranges. A parcel of 80 cm or less falls in the “up to 80” row, so what corresponds to the “up to 100” row is 81 to 100 cm. Likewise, for weight, “up to 5” means 1 to 5 kg, “up to 10” means 6 to 10 kg, and “up to 20” means 11 to 20 kg. Therefore the test data for b must be District A, 3-dimension total 81 to 100 cm, weight 6 to 10 kg, and c must be District A, 3-dimension total 81 to 100 cm, weight 11 to 20 kg. In イ, b (A, 90, 10) has 90 cm within 81 to 100 and 10 kg within 6 to 10, so it matches column 5 exactly. c (A, 90, 11) has 90 cm within 81 to 100 and 11 kg within 11 to 20, so it matches column 6. As a further check on the expected outputs: for b, the 3-dimension total gives category 2 and the weight gives category 2, so category 2 applies and District A costs 1,600 yen; for c, the 3-dimension total gives category 2 and the weight gives category 3, so the larger category 3 applies, giving 2,000 yen. This confirms that the two adjacent columns properly form tests that verify different categories.

  • Incorrectウ

    The weight of 11 kg for b does not fall under “up to 10” but under “up to 20”, so this is data for column c, not for column b. Moreover, c's 21 kg violates requirement (1), which says that a parcel weighing more than 20 kg is not accepted, so it does not exist in any column of Table 2 in the first place and is data that cannot be accepted. It is a double error: b is shifted one column to the right, and c falls outside the table altogether.

  • Incorrectエ

    It is correct that a 3-dimension total of 100 cm falls under “up to 100”, but the weight correspondences are all shifted one row earlier. b's 5 kg falls in the “up to 5” row, so it is column 4; c's 10 kg falls in the “up to 10” row, so it is data for column 5 (the column of b). Even if you match only the 3-dimension-total condition, if the weight range does not match the specified row, it does not become a test of that column.

ここがポイント
  • Read the condition rows of a decision table (output result table) as mutually exclusive: “up to 100” is not 0 to 100 but 81 to 100, the values that do not fall into the row above it, “up to 80”. Likewise, “up to 10” is 6 to 10 kg and “up to 20” is 11 to 20 kg. When mapping test data to columns, the biggest point is not to get this boundary split wrong: which row you place a boundary value such as 80, 5, or 10 into shifts the column by one.
  • For the size category, apply whichever is larger: the category obtained from the 3-dimension total or the category obtained from the weight. Also, a parcel whose 3-dimension total exceeds 140 cm or whose weight exceeds 20 kg is not accepted, so data such as 21 kg does not correspond to any column of Table 2. Table 2 is an expected-value table covering 4 districts × 3 three-dimension-total ranges × 3 weight ranges = 36 combinations, and it is a typical preparation step for black-box testing, which verifies by the correspondence between inputs and expected outputs without looking at the internal structure.
用語

Your answers