Skip to content

平成27年度 春期 ITパスポート試験 問99

This question's explanation and your answers so far.

問99
頻出度★★☆

F社では,新製品を開発するに当たり,100人のモニタを募集して市場調査を行った。モニタには,性能,価格,デザインの三つの項目について,それぞれを重視するかどうかを“はい”又は“いいえ”のいずれかで答えてもらった。 モニタから得られた回答は,図1のレコード形式で回答ファイルに登録した。 レコードの項目“性能”,“価格”,“デザイン”には,それぞれ,質問に対する回答が“はい”の場合には1が,“いいえ”の場合には0が記録されている。 回答ファイルの中から,条件に合致するレコード数を表示するために,次の命令が使用できる。 件数表示(条件) ここで,条件には,and,or及び[ ]を組み合わせた複合条件を指定できる。条件の評価は[ ]の中が優先して評価される。また,[ ]の中にさらに[ ]を記述することもできる。 条件を変えて,命令を実行した結果を表1に示す。 表1 命令を実行した結果

条件件数表示命令の実行結果
性能=155
価格=160
デザイン=145
[性能=1]and[価格=1]30
[価格=1]and[デザイン=1]25

表1の結果から,次の命令を実行したときに表示されるレコード数は幾つか。 件数表示([性能=1] or [価格=1])

出典 平成27年度 春期 ITパスポート試験 問99
解説

問 99

※ Our check while writing this explanation could not fully confirm the published answer; scoring follows IPA's official key.

  • Incorrectア

    60 is exactly the count of [price=1] in Table 1. The union expressed by or includes not only “people who value price” but also “people who value performance”, so the 25 people who do not value price but do value performance (55-30) are left out. This is a typical mistake of answering with the count of just one of the conditions.

  • Incorrectイ

    70 is the value you get when you take the wrong row from Table 1. For example, using 45 for [design=1] instead of 60 for [price=1] gives 55+45-30=70, or subtracting the 30 people of the and condition from the total of 100 respondents gives 100-30=70. Neither calculation corresponds to the condition in the question (the or of performance and price), so it is wrong.

  • ウ

    正解 In this set of linked questions, 100 respondents were asked whether they place importance on “performance”, “price” and “design”, recording 1 for yes and 0 for no. The results in Table 1 are: [performance=1] is 55 records, [price=1] is 60 records, and [performance=1] and [price=1] is 30 records. The or in the command being asked about, Count display ([performance=1] or [price=1]), is a logical OR, so it counts the union of “the set of people who value performance” and “the set of people who value price” (people who satisfy at least one of the two conditions). If you simply add 55+60, the 30 people who value both are counted twice. So you use the inclusion-exclusion principle (size of the union = A + B - A∩B), giving 55+60-30=85. Checking with the breakdown: performance only = 55-30=25 people, price only = 60-30=30 people, and both = 30 people, so 25+30+30=85 people, which matches. Therefore the number of records displayed is 85, and the correct answer is ウ.

  • Incorrectエ

    115 is the value obtained by simply adding 55+60, which counts the 30 people who value both performance and price twice. Moreover, since there are only 100 respondents in total, the number of records can never be 115. This is a representative wrong answer for forgetting to subtract the overlap (the intersection).

ここがポイント
  • In a search condition, or corresponds to logical OR = the union of sets, and and corresponds to logical AND = the intersection. When you count records, use the inclusion-exclusion principle |A∪B|=|A|+|B|-|A∩B| and always remove the double counting of the part that satisfies both conditions.
  • The values read from the table are “the count for each condition”, not a breakdown of mutually exclusive groups. The 55 for [performance=1] already includes the 30 people who value both, so the number of people who value only one of them is easier to picture when you find it by subtraction, such as 55-30=25 (drawing a Venn diagram makes it certain).
用語

Your answers