Binary Examples in CS Thinking

Start with the recap, study the fully worked examples, then use the practice problems to check your understanding of Binary.

This page combines explanation, solved examples, and follow-up practice so you can move from recognition to confident problem-solving in CS Thinking.

Concept Recap

Binary is a base-2 number system that uses only two digits, 0 and 1, to represent all values. Each digit position represents a power of 2, and computers use binary because electronic circuits have exactly two states: on and off.

Counting with only two states: on/off, yes/no, 0/1. Each extra digit doubles the count.

Read the full concept explanation โ†’

How to Use These Examples

  • Read the first worked example with the solution open so the structure is clear.
  • Try the practice problems before revealing each solution.
  • Use the related concepts and background knowledge badges if you feel stuck.

What to Focus On

Core idea: Computers use binary because electronic switches have exactly two states: on (1) or off (0).

Common stuck point: Each position is a power of 2 (1, 2, 4, 8 ...). Reading right-to-left: position 0 = 1, position 1 = 2, etc.

Sense of Study hint: When converting binary to decimal, write the powers of 2 above each digit from right to left (1, 2, 4, 8, 16, \ldots). Then multiply each binary digit by its power and add the results. To convert decimal to binary, repeatedly divide by 2 and record the remainders from bottom to top.

Worked Examples

Example 1

medium
Convert the decimal number 45 to binary.

Solution

  1. 1
    Step 1: 45 รท 2 = 22 remainder 1.
  2. 2
    Step 2: 22 รท 2 = 11 r0. 11 รท 2 = 5 r1. 5 รท 2 = 2 r1. 2 รท 2 = 1 r0. 1 รท 2 = 0 r1.
  3. 3
    Step 3: Read remainders bottom to top: 101101.

Answer

101101_2
Binary (base 2) uses only digits 0 and 1. Repeatedly dividing by 2 and collecting remainders converts decimal to binary. Computers use binary because electronic circuits have two states: on and off.

Example 2

medium
Convert binary 11010_2 to decimal.

Practice Problems

Try these problems on your own first, then open the solution to compare your method.

Example 1

medium
Add the binary numbers 1011_2 and 0110_2.

Example 2

medium
Convert the decimal number 13 to binary using powers of 2.