Learning Objectives
By the end of this topic, you should be able to:
- Convert an unsigned binary integer to its equivalent base‑10 (decimal) value.
- Convert a base‑10 integer to its equivalent unsigned binary representation.
- Convert a 4‑bit (nibble‑length) binary value to its equivalent hexadecimal digit.
- Convert a hexadecimal digit to its equivalent 4‑bit binary value.
Learning Activities
To help you meet the learning objectives, we have prepared a combination of readings, activities, and videos.
Course Readings
These reading were designed to introduce the course topics to an audience of educators. They should be considered "required" and read in order.
- Reading 1: Bits, Bytes, and Abstractions (conceptual foundations)
- Reading 2: 8 Bits and the Integers 0–255 (binary place value and conversions with one byte)
- Reading 3: Hexadecimal: A Shorthand for Binary (conversions between 4‑bit groups and hex digits)
Supplemental Readings
Some participants find it helpful to read about a topic from a source written for a slightly more technical audience. These supplemental readings cover similar material as the course readings but may not fully align with the course learning objectives. Use them as an optional complement to your study, not a substitute for the course readings.
- Reading: Dive into Systems, Chapter 4, Binary and Data Representation
- Reading: Dive into Systems, Chapter 4.1, Number Bases and Unsigned Integers
- Reading: Dive into Systems, Chapter 4.2, Converting Between Bases
Lesson Videos
These videos support the readings above and may present the material with some deeper connections and/or worked examples.
Checking for Understanding, Questions
Review the Learning Objectives from the top of this page. You will be asked to complete these types of problems on this week's competency demo. To help you check if you are on the right track with these concepts, use the following tools and questions as a type of formative self-assessment.
First, the following are two Scratch programs to help you practice conversion from decimal to binary and back again.
- Practice converting from binary to an unsigned integer
- Practice converting from an unsigned integer to binary
Next, consider the following questions. Try each one on your own before looking at the answer key. It is completely fine if you need to revisit the reading or video — that’s part of learning.
Binary → Decimal
- What base‑10 value does the 8‑bit binary number
01010011represent? - What base‑10 value does
11100001represent?
Decimal → Binary (8‑bit, unsigned)
- Write the 8‑bit binary representation of the decimal number
19. - Write the 8‑bit binary representation of the decimal number
200.
Binary ↔ Hexadecimal
- Convert the 4‑bit binary value
1010to hexadecimal. - Convert the hexadecimal digit
Dto its 4‑bit binary equivalent. - Convert the 8‑bit binary number
10111100to hexadecimal (two hex digits). - Convert the hexadecimal value
3Fto its 8‑bit binary equivalent.
How Many Values with N Bits?
- How many unique values can you represent with 8 bits?
- How many unique values can you represent with 10 bits?
- In general, how many unique values can you represent with N bits?
Checking for Understanding, Answers
You can begin be comparing your answers to the following answer key.
Show Answer Key
Binary → Decimal
-
01010011= 64 + 16 + 2 + 1 = 83. -
11100001= 128 + 64 + 32 + 1 = 225.
Decimal → Binary
- 19 = 16 + 2 + 1 →
00010011. - 200 = 128 + 64 + 8 →
11001000.
Binary ↔ Hexadecimal
1010→ decimal 10 →A.D→ decimal 13 → binary1101.-
10111100→ group as1011 1100→ B and C →BC. -
3F→ 3 →0011, F →1111→00111111.
How Many Values with N Bits?
- With 8 bits, you can represent 256 unique values (0–255).
- With 10 bits, you can represent 1024 unique values (0–1023).
- In general, with N bits, you can represent 2N unique values. N represents the number of "slots" or switches, and since each switch has 2 choices (0 or 1), we multiply 2 by itself N times.
If you still have questions or concerns you can use the videos below to try and further your understanding.
Extend Your Learning
The following resources go a little deeper on topics we touched on but did not fully explore in the readings. These are entirely optional — none of this material appears on the Competency Demo — but each one is a natural "next question" from something covered this week.
- Binary addition
Once you can convert between binary and decimal, a natural next question is: can you add two binary numbers directly, without converting first? The answer is yes, and the rules are surprisingly simple. This short reading walks through the four rules of binary addition with clear examples.
Binary Addition