This question's explanation and your answers so far.
問99
頻出度★★☆
多くの市販の書籍には,書籍を識別するための ISBN(International Standard Book Number)コードが付けられている。ISBN コードは,0~9の数字を使った13桁の記号で構成され,左側から桁を数える。最も左側の桁を1桁目とする。1桁目から12桁目までは,国記号,出版者記号及び書籍固有の記号などが含まれる。
ISBN コードの13桁目(最も右側の桁)はチェック数字と呼ばれる桁である。ISBN コードのチェック数字は,1桁目から12桁目の数字を使って,次の計算方法によって求める。ここで,図1のように1桁目から12桁目の数字を a₁~a₁₂,チェック数字を X とする。
〔チェック数字の計算方法〕
(1) a₁~a₁₂について,奇数桁には1,偶数桁には3の重みを付ける。
(2) a₁~a₁₂の各桁に,それぞれの桁に対応した重みを掛けたものの和 S を求める。
S = a₁×1+a₂×3+a₃×1+…+a₁₂×3
(3) S を10で割った余り R を求める。
(4) 10から R を引いた値をチェック数字 X とする。なお,この値が10になった場合は,チェック数字は0とする。
表計算ソフトを使ってチェック数字を求めることにした。チェック数字を求めるワークシートを,次の手順で作成するとき,a に入れる適切な式はどれか。
(1) セル B1~N1に,ISBN コードの桁数を表す数値を入力する。
(2) セル B2~M2に,ISBN コードの1~12桁を,各セルに1桁ずつ入力する。
(3) セル B3~M3に,ISBN コードの各桁に対応した重みを入力する。
(4) セル B4に,式 [ a ] を入力し,セル C4~M4に複写する。
(5) セル B5に,セル B4~M4の合計を求める式を入力する。
(6) セル B6に,セル B5の値を10で割った余りを求める式を入力する。
(7) セル N2に,チェック数字を求める式を入力する。
図2 チェック数字を求めるワークシート
A
B
C
D
E
F
G
H
I
J
K
L
M
N
1
桁
1
2
3
4
5
6
7
8
9
10
11
12
13
2
ISBN コード
9
7
8
4
0
0
0
0
1
2
3
4
3
重み
1
3
1
3
1
3
1
3
1
3
1
3
4
5
和(S)
72
6
剰余(R)
注記 網掛けの部分は,表示していない。
出典 平成24年度 春期 ITパスポート試験 問99
解説
問 99
//
×Incorrectア
B1*B2 multiplies row 1 (the digit position numbers) by row 2 (the digits of the ISBN code), so it does not use row 3, which holds the weights that should be multiplied. When it is copied, it becomes C4=C2*C1=2×7=14 and so on, treating the position number as the weight, and the total becomes 9+14+24+16+0+0+0+0+9+20+33+48 = 173, which does not match the sum (S) = 72 in the figure.
×Incorrectイ
$B1*B$3 is the product of row 1 (the digit position numbers) and row 3 (the weights), and the essential digits of the ISBN code in row 2 do not appear in the formula at all. Moreover, $B1 fixes the column with an absolute reference, so even when it is copied to C4 through M4 it keeps referring to B1 (= 1), and the total is only 1×(1+3+1+3+1+3+1+3+1+3+1+3) = 24. Both the rows referenced and the style of reference are wrong.
○ウ
正解The correct answer is ウ, B2*B3. In the worksheet of Figure 2, row 2 holds each digit of the ISBN code (digits 1 to 12), row 3 holds the weight corresponding to each digit (1, 3, 1, 3, ...), row 4 computes the product of each digit and its weight, row 5 gives the sum S of those products, and row 6 gives the remainder R when S is divided by 10. Therefore the formula to enter in B4 is B2*B3, which multiplies row 2 by row 3 within the same column B. It is important to leave the references relative here (no $): when B4 is copied sideways to C4 through M4, only the referenced column shifts one step to the right, so the formulas automatically become C4=C2*C3, D4=D2*D3, ..., M4=M2*M3, each digit correctly multiplied by the weight of its own position. Checking the arithmetic, 9×1+7×3+8×1+4×3+0×1+0×3+0×1+0×3+1×1+2×3+3×1+4×3 = 72, which matches the sum (S) = 72 shown in cell B5 of the figure, confirming that ウ is correct.
×Incorrectエ
The rows it refers to (rows 2 and 3) are themselves correct, but the mistake is fixing column B with an absolute reference, as in $B2. When this formula is copied to C4 through M4, $B2 does not move, so C4=$B2*C$3=9×3=27, D4=$B2*D$3=9×1=9, and so on, meaning the first digit 9 is used for every position. The total becomes 9×(1+3+1+3+1+3+1+3+1+3+1+3) = 216, which does not match the sum (S) = 72 in the figure. Since the intent is to copy sideways so that the column shifts, the column must not be made an absolute reference.
ここがポイント
The general procedure for computing a check digit: multiply each digit by its prescribed weight, obtain the sum S, and then determine the check digit from the remainder R of S divided by the modulus (10 in this question). In ISBN-13 the weights alternate as 1, 3, 1, 3, and so on.
How to tell relative and absolute references apart in spreadsheet software: a relative reference without $ shifts its target by the direction and distance it is copied, while the part marked with $ ($B fixes the column, B$3 fixes the row) stays put. In a formula you want to copy sideways so that the column shifts one step at a time, you must not put $ on the column.