Skip to content

令和8年度 ITパスポート試験 問74

This question's explanation and your answers so far.

問74
頻出度★★☆

表計算ソフトを用いて,二つの2進数α,βの和を求める。α,βの桁数は2桁に限定し,2の位,1の位の順に各桁の値がセルB3,セルC3とセルB4,セルC4に入力されている。ワークシートは2進数α=10,β=11の例である。結果は,4の位,2の位,1の位の順にセルA5,セルB5,セルC5に表示したい。セルB2は1の位からの繰り上がりの情報を格納するために用いられ,式IF(C3+C4=2,1,0)が入力されている。

ABCD
14の位2の位1の位
20:1の位からの繰上げ
310:2進数αの値
411:2進数βの値
5101:結果の表示

セルB5に入力する式はどれか。

出典 令和8年度 ITパスポート試験 問74
解説

問 74

  • ア

    正解 B5 represents the 2's place of the result. Three things are added into the 2's-place digit: the carry from the 1's place B2, the 2's place of α B3, and the 2's place of β B4; their total SUM(B2:B4) takes a value from 0 to 3. The 2's-place digit to display is the remainder of this total divided by 2 (total 0→0, 1→1, 2(=binary 10)→0, 3(=binary 11)→1). Choice ア outputs the value itself as the digit when the total is less than 2 (0 or 1), outputs 0 when the total is 2, and otherwise (total 3) returns 1, so it gives the correct 2's-place digit in every case. In the example, SUM(B2:B4)=0+1+1=2, so ア returns 0, matching B5=0 in the figure.

  • Incorrectイ

    The inner branch is reversed, returning 1 when the total is 2 and 0 when the total is 3. But the 2's place in binary must be 0 when the total is 2(=10)and 1 when the total is 3(=11), so the values are inverted. In the example the total is 2, so it outputs 1, which conflicts with the correct 0 (B5=0 in the figure).

  • Incorrectウ

    The outer condition is 「SUM(B2:B4)>2」, so when the total is 0 or 1 it falls into the inner “otherwise” branch and always returns 1, wrongly outputting 1 even when the total is 0. Moreover, when the total is 3 it displays the total value 3 as is, which is not a single binary digit (0 or 1) and breaks down as a digit.

  • Incorrectエ

    Because the outer condition is 「SUM(B2:B4)>2」, when the total is 3 it displays 3 as is and does not become a single digit. Also it returns 0 for both total 0 and 1, so when the total is 1 the 2's place that should be 1 becomes 0. Even in the example (total 2) it returns 1, not matching the correct 0.

ここがポイント
  • Addition of each binary digit is computed by “the remainder of that digit's total divided by 2 = the value left in that digit, the quotient = the carry to the higher digit”. In a spreadsheet, nested IF branches the digit's value according to each value of the total.
  • SUM is the total of the argument range. The key point here is to map SUM(B2:B4) via the three branches “less than 2 / equal to 2 / otherwise(=3)” to 0,1,0,1, thereby reproducing the remainder (mod 2).
用語

Your answers