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,โ€ฆ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.

Common Mistakes to Watch For

Before you work through the examples, skim the mistake guide so you know which shortcuts and sign errors to avoid.

Worked Examples

Example 1

medium
Convert the decimal number 45 to binary.

Answer

1011012101101_2

First step

1
Step 1: 45 รท 2 = 22 remainder 1.

See the full worked solution + why-it-works coaching

SetupKey insightWhy it worksCommon pitfallConnection

Unlock answer keys One Family plan โ€” every worked solution, all subjects

Example 2

medium
Convert binary 11010211010_2 to decimal.

Example 3

medium
Convert 111121111_2 to decimal and explain why it equals 24โˆ’12^4 - 1.

Example 4

hard
Convert decimal 100 to binary by repeatedly dividing by 2 and recording remainders.

Practice Problems

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

Example 1

medium
Add the binary numbers 101121011_2 and 011020110_2.

Example 2

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

Example 3

easy
Convert the binary number 101121011_2 to decimal.

Example 4

easy
Convert 100021000_2 to decimal.

Example 5

easy
What is the decimal value of 1112111_2?

Example 6

easy
Why do computers use binary instead of decimal?

Example 7

easy
Convert decimal 5 to binary.

Example 8

easy
In binary, what is 1+11 + 1?

Example 9

easy
What is the rightmost (position 0) place value in binary?

Example 10

easy
How many distinct values can 3 binary digits represent?

Example 11

medium
Convert decimal 19 to binary.

Example 12

medium
Convert 11010211010_2 to decimal.

Example 13

medium
Add 1012+0112101_2 + 011_2 in binary. Give the binary result.

Example 14

medium
What is the largest decimal value representable with 4 bits?

Example 15

medium
Doubling a binary number is done by what simple operation?

Example 16

medium
Convert 10110210110_2 to decimal.

Example 17

medium
How many bits are needed to represent decimal 100?

Example 18

challenge
What decimal value is 11111111211111111_2 (eight 1s), and why is this number significant?

Example 19

challenge
Subtract in binary: 10102โˆ’001121010_2 - 0011_2. Give the binary result.

Example 20

challenge
In binary, what does shifting 110021100_2 right by one position produce, and what arithmetic operation is that (for the integer part)?

Example 21

medium
Convert decimal 42 to binary.

Example 22

medium
Convert 110121101_2 to decimal.

Example 23

easy
Convert the binary number 100121001_2 to decimal.

Example 24

easy
Convert decimal 3 to binary.

Example 25

easy
What is the decimal value of 1102110_2?

Example 26

easy
Convert decimal 6 to binary.

Example 27

easy
In binary, what is 102+1210_2 + 1_2?

Example 28

easy
How many distinct values can 5 binary digits represent?

Example 29

medium
Convert decimal 23 to binary.

Example 30

medium
Convert 10101210101_2 to decimal.

Example 31

medium
Add 1102+1012110_2 + 101_2 in binary. Give the binary result.

Example 32

medium
What is the largest decimal value representable with 6 bits (unsigned)?

Example 33

medium
Convert 11100211100_2 to decimal.

Example 34

medium
How many bits are needed to represent decimal 200?

Example 35

medium
Convert decimal 50 to binary.

Example 36

medium
In binary, what is 1+1+11 + 1 + 1? Give the binary result.

Example 37

medium
Convert 1000002100000_2 to decimal.

Example 38

medium
How many bits are needed to represent decimal 64?

Example 39

hard
Add 11012+101121101_2 + 1011_2. Give the binary sum.

Example 40

hard
Subtract in binary: 100002โˆ’1210000_2 - 1_2. Give the binary result.

Example 41

hard
What does shifting 101021010_2 LEFT by one position produce, and what arithmetic operation is that?

Example 42

hard
How many 1-bits are in the binary representation of decimal 255?

Example 43

challenge
Convert decimal 170 to binary.