CS U111 · Block B · drill
Number systems: the six methods, then drill
The six conversions the mid-sem papers ask for, each on one card with a worked example taken from a past paper, then a self-marking drill. The drill generates a fresh sheet each time, and every answer comes with its own worked method.
What's at stake: about 2–8 marks per mid-sem. The 2025 paper gave it a whole question (8 marks: Q3), and the 2024 and 2026 papers had one or two multiple-choice questions (2024 Q6, 2026 Q4, 2026 Q10).
Where you stand: it's purely mechanical. There are no ideas to understand deeply, just six fixed procedures. Fractional conversions and 2's complement aren't in most school syllabuses, so they're new for most of the hall, not just for you. Ten minutes a day for a week (one drill sheet a day) is enough to make them automatic.
The method on one screen
A number's digits are counts of powers of the base. In base 10, 143 = 1·100 + 4·10 + 3·1. In base 2 the place values are 1, 2, 4, 8, 16, … and each digit is 0 or 1. Everything below is bookkeeping around that one idea.
Method 1 · 2026 Q4
Decimal → base b: divide, collect remainders, read bottom-up
Convert (143)10 to binary.
- Divide by the base (2) and write down the quotient and remainder. Divide the quotient again, and keep going until the quotient is 0.
- The remainders are the digits, least significant first: the first remainder is the 1s digit. So read them from the bottom up.
| n | n ÷ 2 | remainder |
|---|---|---|
| 143 | 71 | 1 |
| 71 | 35 | 1 |
| 35 | 17 | 1 |
| 17 | 8 | 1 |
| 8 | 4 | 0 |
| 4 | 2 | 0 |
| 2 | 1 | 0 |
| 1 | 0 | 1 ↑ read upward |
Reading upward gives 10001111. Check with place values: 128 + 8 + 4 + 2 + 1 = 143 ✓. For base 8 or 16, divide by 8 or 16 instead. In hex, remainders 10–15 are written A–F.
Method 2 · 2025 Q3(c)
Decimal fraction → base b: multiply, collect integer parts, read top-down
Convert (209.375)10 to octal. The two parts are converted separately.
- Integer part 209, by Method 1 with base 8: 209 ÷ 8 = 26 r 1, 26 ÷ 8 = 3 r 2, 3 ÷ 8 = 0 r 3. Reading bottom-up gives 321.
- Fraction part 0.375: multiply by the base. The integer part of the product is the next digit, and the fractional part carries on to the next row:
fraction × 8 digit carry on with 0.375 3.0 3 ↓ 0 — stop - The fraction digits come out most significant first, so read them top-down. Answer:
321.3. Check: 3·64 + 2·8 + 1 + 3/8 = 209.375 ✓.
When does it stop? Only when the fraction reaches exactly 0. That happens if the fraction, in lowest terms, has a denominator whose prime factors all divide the base. For bases 2, 8 and 16 that means a power of 2: 0.375 = 3/8 stops. 0.1 = 1/10 never stops (0.000110011… in binary), so a question will say "to 5 places". Write exactly that many digits and truncate (don't round) unless told otherwise.
Method 3 · 2025 Q3(a), backwards
Base b → decimal: multiply each digit by its place value and add
Convert (1001.001)2 to decimal.
- Label the places. Left of the point they are b0, b1, b2, …, going left. Right of the point they are b−1, b−2, …, going right.
- Add digit × place value: 1·8 + 0·4 + 0·2 + 1·1 + 0·½ + 0·¼ + 1·⅛ = 9.125.
- For hex, convert letters first (A = 10 … F = 15): (5C)16 = 5·16 + 12 = 92.
Method 4 · 2025 Q3(b)
Binary ↔ octal / hex: group 3 or 4 bits outward from the point
Since 8 = 23 and 16 = 24, each octal digit is exactly 3 bits and each hex digit exactly 4. You never go through decimal.
- Hex → binary: replace each digit with its 4-bit pattern. For (5C.A3)16: 5 =
0101, C =1100, A =1010, 3 =0011, giving01011100.10100011. The leading 0 can be dropped:1011100.10100011. - Binary → octal/hex: start at the point and work outward. The integer part is grouped leftward, padding with 0s on the far left. The fraction part is grouped rightward, padding with 0s on the far right. Then replace each group with its digit.
1011101.011 grouped from the point. The padding 0s (in rust) go at the outer ends only. Result: octal 135.3, hex 5D.6.Check: (1011101.011)2 = 93.375, (135.3)8 = 64 + 24 + 5 + 3/8 = 93.375 ✓, and (5D.6)16 = 80 + 13 + 6/16 = 93.375 ✓.
Method 5 · 2025 Q3(d)
8-bit 2's complement: invert and add 1, in both directions
In 8-bit 2's complement the leftmost bit has place value −128 instead of +128. Every other place is ordinary. So the range is −128 to 127, and a leading 1 means the number is negative.
- Positive number (53): plain binary, padded to 8 bits. 53 = 32 + 16 + 4 + 1, giving
00110101. No inverting. - Negative number (−69): write +69 in 8 bits:
01000101. Invert every bit:10111010. Add 1:10111011. - Reading a pattern back: if it starts with 0, read it as ordinary binary. If it starts with 1, it's negative: invert and add 1 to get the size, then attach the minus sign. For
10111011: invert gives01000100, add 1 gives01000101= 69, so the value is −69. - Quick check with the −128 weight: −128 + 32 + 16 + 8 + 2 + 1 = −69 ✓.
Method 6 · 2024 Q6
Unknown-base equations: expand, solve, check the digits
Find x if (10)8 = (12)x.
- Turn the known side into decimal: (10)8 = 1·8 + 0 = 8.
- Expand the unknown side with x as the base: (12)x = 1·x + 2.
- Solve: x + 2 = 8, so x = 6.
- Check that the digits are legal: every digit must be less than the base. Here 2 < 6 ✓. With three digits you get a quadratic in x. Since the left side grows as x grows, just try bases upward from (largest digit + 1).
1) Reading the remainders top-down: this writes the number backwards. For repeated division the first remainder is the last digit. 2) Reading the fraction digits bottom-up: it's the opposite rule. For repeated multiplication the first integer part is the first digit after the point. 3) Grouping the fraction from the left end of the whole string: always group outward from the point. .011 is octal .3, but if you pad on the wrong side (.011 → .0011 → hex) you get .3 in hex instead of the correct .6. 4) Forgetting to pad to 8 bits: 53 must be written 00110101, not 110101. In 2's complement the leading bit means something. 5) Taking the 2's complement of a positive number: only negative numbers are inverted and incremented. 6) A digit that's too big for the base, like (19)8. The digit 9 doesn't exist in octal.
The drill
Six questions per sheet. Work each one on paper, type the answer, then press Reveal all. Every answer has a "See the method" disclosure with the division or multiplication table for that question. Equivalent forms are accepted: 0101 = 101, 12.50 = 12.5, and hex in either case. The one exception is 2's complement, where you must give all 8 bits.
Untick every other family and do a sheet of just that one. Six in a row with the method open beside you, then six without it. Most errors are one of the six classic traps above. Name which one before moving on.