• Practice
  • About 14 min
  • 5 practice questions

Number system problems: speed methods and traps

Convert between binary, decimal and hexadecimal quickly using a weight table, add binary numbers, and avoid the usual traps about invalid digits.

If something looks wrong, please tell us.

Number system questions are among the most predictable in Computer Fundamentals. They also reward practice: with a fixed method you can answer each in under a minute. This lesson gives the method for each type and four worked problems.

The weight table

Binary weights from the left
Place8th7th6th5th4th3rd2nd1st
Weight1286432168421

Binary to decimal: write the weights under the bits and add those above a 1. Decimal to binary: go along the weights from the left; write 1 if the weight fits into what remains, subtract it, otherwise write 0. Binary to hexadecimal: group in fours from the right. Binary to octal: group in threes from the right.

Worked example 1: binary to decimal

Convert 10110. The weights for 5 bits are 16, 8, 4, 2, 1. The bits 1, 0, 1, 1, 0 select 16, 4 and 2. Sum = 16 + 4 + 2 = 22.

Worked example 2: decimal to binary by weights

Convert 77. 64 fits: 77 - 64 = 13, write 1. 32 does not fit: 0. 16 does not fit: 0. 8 fits: 13 - 8 = 5, write 1. 4 fits: 5 - 4 = 1, write 1. 2 does not fit: 0. 1 fits: write 1. The bits are 1 0 0 1 1 0 1, so 77 = 1001101. Check: 64 + 8 + 4 + 1 = 77.

Worked example 3: hexadecimal

Convert 3C from hexadecimal to decimal: 3 x 16 + 12 = 48 + 12 = 60. Convert binary 11011011 to hexadecimal: group as 1101 and 1011, which are 13 and 11, written D and B, so the answer is DB. As a check, DB = 13 x 16 + 11 = 208 + 11 = 219, and the binary number is 128 + 64 + 16 + 8 + 2 + 1 = 219.

Worked example 4: binary addition

The rules are 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 10 (write 0, carry 1) and 1 + 1 + 1 = 11 (write 1, carry 1). Add 1011 and 0110 from the right. Bit 1: 1 + 0 = 1. Bit 2: 1 + 1 = 10, write 0 carry 1. Bit 3: 0 + 1 + carry 1 = 10, write 0 carry 1. Bit 4: 1 + 0 + carry 1 = 10, write 0 carry 1. The final carry becomes the new leading 1. The result is 10001. Check in decimal: 11 + 6 = 17, and 10001 = 16 + 1 = 17.

Traps

  • A binary number may contain only 0 and 1, so 1021 is invalid.
  • An octal number may contain only 0 to 7, so 358 is invalid.
  • Hexadecimal letters stop at F, so 2G is invalid.
  • When grouping bits for hex or octal, group from the right and pad with zeros on the left.

Weights for binary: 128, 64, 32, 16, 8, 4, 2, 1. Group by 4 for hex, by 3 for octal.

Key takeaways

  • Use the weight table for conversions both ways.
  • One hex digit = 4 bits; one octal digit = 3 bits.
  • Check an answer by converting back.
  • Check digits for validity before converting.

Check your understanding

  1. 1. What is decimal 100 in binary?

    1. 1010100
    2. 1001100
    3. 1100100
    4. 1100010
    Show answer

    Answer: C. 100 = 64 + 32 + 4, so the bits for 64, 32 and 4 are set: 1100100.

  2. 2. What is binary 10110 + 101 in binary?

    1. 10011
    2. 11011
    3. 11101
    4. 101011
    Show answer

    Answer: B. 22 + 5 = 27, and 27 = 16 + 8 + 2 + 1 = 11011.

  3. 3. What is the decimal value of hexadecimal 7F?

    1. 112
    2. 255
    3. 127
    4. 79
    Show answer

    Answer: C. 7 x 16 + 15 = 112 + 15 = 127.

  4. 4. Which of the following is NOT a valid binary number?

    1. 1010
    2. 1111
    3. 0001
    4. 1021
    Show answer

    Answer: D. Binary allows only the digits 0 and 1. The digit 2 makes 1021 invalid.

  5. 5. What is binary 11010111 in hexadecimal?

    1. D7
    2. 7D
    3. B7
    4. D5
    Show answer

    Answer: A. Group as 1101 and 0111, which are 13 (D) and 7, so the answer is D7.

Privacy · Terms · Refunds · Delivery