Computer science · 01 / 06

Binary: position determines weight

Middle school · Worked example and 4 exercises with solutions, at your pace.

The principle, simply

Positional notation multiplies each digit by a power of the base. Binary digits are 0 and 1; right-to-left weights are 1, 2, 4, 8 and so on. Unsigned, signed and floating-point encodings interpret bit patterns differently.

n=1*2^3+0*2^2+1*2+1
THE PICTURE TO REMEMBERBinary: position determines weight
1× 80× 41× 21× 1

1011₂ = 11₁₀

  1. 01Digits
  2. 02Positional weights
  3. 03Products
  4. 04Decimal sum

WORKED EXAMPLE

From principle to reasoning

1011₂ = 8 + 0 + 2 + 1 = 11₁₀. One hexadecimal digit corresponds to four bits; A to F represent 10 to 15.

Solve a problem in this subject

  1. Specify the contract

    Define inputs, types, outputs and forbidden cases. State whether a search algorithm requires sorted data.

  2. Trace a small example

    Tabulate variables, tested conditions and actions using a small hand-checkable example.

  3. Test boundaries

    Consider empty inputs, one item, duplicates, missing values and numeric limits where relevant. Define the output or explain rejection.

  4. Justify

    Explain termination and correctness. Distinguish operation counts, measured time and memory use.

YOUR TURN

01 · Try before checking

Convert 1101₂ to decimal.

One hint

Write weights 8, 4, 2, 1 below the digits.

Reveal and understand the solution

8 + 4 + 0 + 1 = 13.

Compare method, conditions and answer; identify the exact part to revisit.

IMPROVE THROUGH PRACTICE

Three additional challenges with solutions

Start with the first challenge. Write your method before opening a hint; use the solution to find the first step that needs work.

Reflect after practising
02 · Recognise and understandLink to this exercise

Convert 10110₂ to decimal.

A hint to get started

Use weights 16,8,4,2,1.

Step-by-step solution
  1. Active bits contribute 16 + 4 + 2.
  2. The sum is 22.
  3. Positions have powers-of-two weights.

Which step did you miss? Retry without help, then explain why the method works.

03 · Apply the methodLink to this exercise

Write unsigned 13 in binary.

A hint to get started

Decompose 13 into powers of two.

Step-by-step solution
  1. 13 = 8 + 4 + 1.
  2. Weights 8,4,2,1 give 1,1,0,1.
  3. 13₁₀ = 1101₂.

Which step did you miss? Retry without help, then explain why the method works.

04 · Go furtherLink to this exercise

What is the maximum unsigned 8-bit integer?

A hint to get started

All bits are 1.

Step-by-step solution
  1. The weights sum to 1 + 2 + … + 128.
  2. This equals 2⁸ − 1 = 255.
  3. There are 256 values from 0 to 255, not a maximum of 256.

Which step did you miss? Retry without help, then explain why the method works.

The trap to avoid

State the base and signedness convention.

Without notes, can you…

  • Explain the principle in your own words?
  • Rebuild the diagram and its connections?
  • Solve the exercise and justify the method?

Choosing a state saves it in this browser. This is your assessment, not a grade.