8進数の55を16進数で表したものはどれか。
平成21年度 秋期 ITパスポート試験 問64
This question's explanation and your answers so far.
問 64
- ア
正解 First convert the octal number 55 to decimal. In octal, the digits from the right carry weights of 8 to the power 0 and 8 to the power 1, so 5×8 + 5×1 = 40 + 5 = 45. Next convert the decimal number 45 to hexadecimal. 45 ÷ 16 = 2 remainder 13, and in hexadecimal 13 is written as D, so 45 is 2D. There is also a shortcut through binary: one octal digit corresponds to three binary digits, so 55(8) → 101 101(2) = 101101. Regrouping this into blocks of four digits from the right gives 10 1101, where 10(2)=2 and 1101(2)=13=D, which again gives 2D. Therefore the correct answer is ア.
Incorrectイ
2E is 2×16 + 14 = 46 in decimal, which is one greater than 45. The value of octal 55 is 45, so it does not match (46 written in octal would be 56).
Incorrectウ
4D is 4×16 + 13 = 77 in decimal (115 in octal), which is a different value from octal 55 = decimal 45. It is the trap for anyone who picks a similar-looking value without actually carrying out the radix conversion.
Incorrectエ
4E is 4×16 + 14 = 78 in decimal, which is far from 45. It is the value obtained when both the upper and the lower digit are misjudged, and it does not match the quantity represented by octal 55.
- Basic procedure for radix conversion: when converting between different radixes, going through decimal first is the safest route (sum of each digit times a power of the radix, then repeated division by the target radix taking quotients and remainders).
- Octal and hexadecimal convert faster through binary: one octal digit equals three binary digits, and one hexadecimal digit equals four binary digits. Expand to binary and regroup, and the conversion needs no arithmetic. Also, the hexadecimal digits A to F represent 10 to 15.