What is the decimal equivalent of the hexadecimal number 5A6D?
- (a)23149
- (b)23148
- (c)23147
- (d)13149
Correct — A, (a) 23149. Hexadecimal is base sixteen, so each digit carries a weight sixteen times the one to its right, and the letters A to F stand for the values ten to fifteen. In 5A6D the digits are 5, A = 10, 6 and D = 13, and the weights from the left are 16³ = 4096, 16² = 256, 16¹ = 16 and 16⁰ = 1. So the value is 5 × 4096 + 10 × 256 + 6 × 16 + 13 × 1 = 20480 + 2560 + 96 + 13 = 23149. There is a faster route that avoids remembering any power of sixteen. Take the digits from the left, and at each step multiply the running total by sixteen and add the next digit: start with 5; 5 × 16 + 10 = 90; 90 × 16 + 6 = 1446; 1446 × 16 + 13 = 23149. Four small multiplications, no table of powers, and no chance of putting a digit in the wrong column — this is the method to use under time pressure. Two checks settle the answer without doing the sum at all, and both are worth having. The first is a bound: the leading digit is 5, so the number lies between 5000 and 6000 in hexadecimal, which in decimal is between 5 × 4096 = 20480 and 6 × 4096 = 24576. Any option outside that window is wrong on sight. The second is a remainder: the last hexadecimal digit is the remainder on division by sixteen, and D is 13, so the decimal answer must leave 13 when divided by 16. Since 16 × 1446 = 23136, the only value among the printed options that leaves 13 is 23149 — the others leave 12 and 11. If a binary form is wanted, each hexadecimal digit expands to four bits: 5 is 0101, A is 1010, 6 is 0110 and D is 1101, giving 0101 1010 0110 1101. That correspondence is the reason hexadecimal is used at all, since it writes a byte in exactly two digits.
- (b)23148 — One less than the true value, which places the error in the units digit and therefore in the letter D. Reading D as 12 instead of 13 gives 20480 + 2560 + 96 + 12 = 23148, and that misreading happens when the letters are counted off from the wrong starting point — A must be 10, B 11, C 12, D 13, E 14, F 15. There is also a check that kills this option before any arithmetic: the last hexadecimal digit is odd, since D is 13, so the decimal value must be odd, and 23148 is even. Anyone converting under time pressure should look at the parity of the final digit first, because it disposes of an entire option for free.
- (c)23147 — Two less than the true value, so again the units position and again the letter D, this time read as 11 — the value that belongs to B. It survives the parity check, being odd, which makes it the more dangerous of the two near misses, but it fails the remainder test: the final hexadecimal digit is the remainder left when the number is divided by sixteen, and since 16 × 1446 = 23136, the value 23147 leaves 11 rather than the required 13. The general lesson is that when three options differ only in their last digit, the discriminating information is in the last digit of the original number, and it can be tested on its own without converting the rest.
- (d)13149 — This differs from the true value in the leading digit rather than the last, and it is the option that a rough sanity check disposes of instantly. The leading hexadecimal digit is 5, so the number cannot be smaller than 5 × 4096 = 20480 or larger than 6 × 4096 = 24576, and 13149 sits well below that window. Arithmetically it corresponds to valuing the leading 5 at 10480 rather than 20480 — that is, using 2096 in place of 4096 for the third power of sixteen — or simply to a slip in writing down a five-digit answer. Fixing the four powers of sixteen in memory, 1, 16, 256 and 4096, removes the whole class of error, and the Horner method removes the need for them altogether.
A positional number system writes a value as a string of digits whose weights are successive powers of the base, counted from zero at the right. Hexadecimal has base sixteen and needs sixteen digit symbols, so it borrows the letters A to F for the values ten to fifteen. Converting from hexadecimal to decimal is therefore just an evaluation: multiply each digit by the power of sixteen belonging to its place and add. The powers worth memorising are the first four — 1, 16, 256 and 4096 — because almost every examination item stays within four digits. The alternative and better method for hand work is the nested one, sometimes called Horner's method: run through the digits from the left, multiplying the running total by the base and adding the next digit each time, which reduces the whole conversion to a chain of small multiplications and never asks for a power at all. Going the other way, from decimal to hexadecimal, the number is divided repeatedly by sixteen and the remainders read upwards. The reason hexadecimal exists in computing is its exact relationship with binary: sixteen is the fourth power of two, so one hexadecimal digit corresponds to precisely four bits and one byte is written in exactly two digits, which is why memory addresses, colour codes and machine-level dumps are all printed in hex. The same fourth-power relationship holds between octal and binary at three bits per digit, which is why conversions between binary, octal and hexadecimal are done by grouping bits rather than by arithmetic.
Number system conversion is the one computer topic in this paper that is purely mechanical, and the Commission sets at least one item of the kind in each computer block — this one from hexadecimal to decimal, and another later from octal to binary. That makes the topic among the highest-value in the syllabus: there is no fact to recall, no ambiguity to argue about, and the answer is either right or wrong in under a minute. The design of the option set is the thing to study. Three of the four values differ from one another only in the units digit, which means the whole question turns on the value of the letter D, while the fourth differs in the leading digit and can be eliminated by a bound. That is a common shape, and it means a candidate who is short of time can often reach the answer by checking the last digit and the size rather than by converting. Both checks are exact rather than approximate, which is what makes them safe to rely on.
- In hexadecimal the digits A to F carry the values 10 to 15, and the place weights from the right are 1, 16, 256 and 4096.
- 5A6D = 5 × 4096 + 10 × 256 + 6 × 16 + 13 = 20480 + 2560 + 96 + 13 = 23149.
- The nested method — multiply the running total by sixteen and add the next digit, working from the left — converts any hexadecimal number without using powers at all.
- The last hexadecimal digit is the remainder on division by sixteen, so a candidate answer can be tested by that remainder alone.
- The leading digit fixes a range: a four-digit hexadecimal number beginning with 5 lies between 20480 and 24576 in decimal.
- Each hexadecimal digit corresponds to exactly four bits, so 5A6D is 0101 1010 0110 1101 in binary, and one byte is written in two hexadecimal digits.
- Decimal to hexadecimal goes the other way, by dividing repeatedly by sixteen and reading the remainders upwards.
- Misvaluing a letter digit; A is 10 and D is 13, and an off-by-one here changes only the last digit of the answer, which is exactly where three of the options differ
- Losing a place value by starting the powers at 16 rather than at 1 for the rightmost digit
- Doing the whole conversion when a bound or a remainder would have settled it — the leading digit fixes the range and the last digit fixes the remainder on division by sixteen
- Reading a hexadecimal string as decimal because it happens to contain only digits; the base has to be taken from the question
- Grouping bits from the left when converting binary to hexadecimal; the grouping into fours must start at the right
Each computer block of this paper carries a conversion item, and the pair in this paper runs in opposite directions — hexadecimal to decimal here, octal to binary later — so both routines need to be fluent. Expect near-miss options that differ in a single digit, which is the examiner's way of punishing a slip rather than a misunderstanding, and expect one option that is out of range, which is a free elimination. Practise the nested multiplication method until it is faster than looking up powers.
No directly related past PYQ was found.
- practice — not a real PYQ
What is the decimal equivalent of the hexadecimal number 2F3?
- (a)755
- (b)723
- (c)815
- (d)1023
Answer(a) 755 — evaluate 2 × 256 + 15 × 16 + 3 = 512 + 240 + 3 = 755, or use the nested method: 2 × 16 + 15 = 47, then 47 × 16 + 3 = 755. The last hexadecimal digit is 3, so the decimal value must leave a remainder of 3 on division by sixteen, and 755 = 16 × 47 + 3 does.
- practice — not a real PYQ
The binary equivalent of the hexadecimal number 5A6D is
- (a)0101 1010 0110 1101
- (b)0110 1010 0101 1101
- (c)0101 1011 0110 1100
- (d)1010 0101 1101 0110
Answer(a) 0101 1010 0110 1101 — each hexadecimal digit expands to exactly four bits, so 5 becomes 0101, A becomes 1010, 6 becomes 0110 and D becomes 1101, and the groups are written in the same order as the digits. This four-bit correspondence, which follows from sixteen being the fourth power of two, is why hexadecimal is used to write binary compactly.