1. L.O: STUDENTS WILL
UNDERSTAND AND USE
BINARY REPRESENTATION.
30-60 minutes (1-2 class periods)
DO NOW: what is the value of the
following numbers?
0000, 0001, 0010, 0011, 1111, 10000?
3. Have you ever seen this movie?What were the directors trying to
show by filming scenes like this?
This is BINARY;
the REAL “language” of computers!
Binary number is a representation of
numbers using only two digits (0 and 1)
4. People typically work with
DECIMAL numbers using the base
10 (decimal) numeral system…
other systems
are relevant in
computer
science,
including
binary (base 2)
and
hexadecimal
(base 16).
Computers manage data packed as
sequences of bits (binary digits),
which are all zeros or ones.
People are most familiar with base 10, so
we write software that allows people to
use base 10 to communicate with the
computer.
5. In base 10, there are ten digits (0-9),
and each place is worth ten times the
place to its right.
6. In binary, base 2, there are only two digits
(0 and 1), and each place is worth two
times the place to its right.
The subscript 2 on
11012 means the 1101 is
in base 2. Numbers are
normally written in base
10, so a subscript 10 is
only used when needed
for clarity.
7. For You To Do: Watch this Binary Timer Snap!
program run. Write a description of the binary
counter's behavior. Explain what you see going on.
8. base 10
• In base 10 notation, each place value
represents a power of ten: the units
place (100 = 1), the tens place (101 = 10),
the hundreds place (102 = 100), the
thousands place (103 = 1000), etc. So, for
example:
9827 = 9 × 103 + 8 × 102 + 2 × 101 + 7 × 100
9. Reading Binary
• Base 2 uses the same idea but with powers of two
instead of powers of ten. Binary place values
represent the units place (20 = 1), the twos place
(21 = 2), the fours place (22 = 4), the eights place (23
= 8), the sixteens place (24 = 16), etc. So, for
example:
100102 = 1 × 24 + 0 × 23 + 0 × 22 + 1 × 21 + 0 ×
20 = 16 + 2 = 1810
10. We will now watch a video
on abstraction: numbers
https://youtu.be/SqhbDWVOLvk
11. Binary numbers are a form of abstraction
because the 1’s and 0’s is the “language”
the computer understands.
Binary numbers are abstraction because when
we use a computer, everything we do is
turned into the 1’s and 0’s of binary behind
the “scenes”
12. How to turn binary (base 2) to decimals
(base 10)
To translate from binary (like 1011012 ) to base 10,
1. first, write the number out on paper.
2. Then write out the binary place values by doubling
left from the units place:
1 0 1 1 0 1
32 16 8 4 2 1
This means this number is 32 + 8 + 4 + 1.
So, 101101 2 = 4510
13. 2. Translate these binary numerals into
base 10 notation:
a.1012
b.1112
c.10100112
5
7
83
510
710
8310
14. Turning decimal into Binary
To translate from base 10 (like 8910 to base 2,
1. first write out the binary place values by doubling
left from the units place until you get to a value
larger than your number. (256 for this example)
2. Then think, "My number is smaller than 128, so I can
leave that place blank
3. But I can take out a 64, so I write a 1 there, and
there's 25 left (89 – 64)
4. I have 0 thirty-twos, because I only have 25. But I can
take out 16,
5. and there's 9 left. So, 8 and 1 are the last nonzero
bits.
16. In mathematics and computer science,
an algorithm is a sequence of actions
to be performed.
a. First, find the largest power of two that
fits inside the number.
b. Then, subtract that power of 2 from the
number, keep the new number, and
record a 1 in the place for that power of
2.
Algorithms perform
calculations, data processing
and/or automated tasks.
Here's an algorithm you can follow to find the
base 2 representation of any base 10 integer:
c. Then, determine if the next largest
power of 2 fits inside the new number,
and:
• If it does, subtract that power of 2
from the number, keep the new
number, and record a 1 in the place
for that power of 2.
• If it doesn't, keep the same number,
and record a 0 for that power of 2
d. Repeat this whole step with the
next largest power of 2 until you
have a bit (1 or 0) for all the
remaining places down to and
including the ones place (by which
point you should have nothing left
of the original number).
The string of ones and
zeros you have recorded
is the binary
representation of your
original number.
21. Learning Objectives:
• LO 2.1.1 Describe the variety of
abstractions used to represent
data. [P3]
• LO 2.1.2 Explain how binary
sequences are used to represent
digital data. [P5]
22. Enduring Understandings:
•EU 2.1 A variety of
abstractions built upon
binary sequences can be
used to represent all
digital data.
23. Essential Knowledge:
1. EK 2.1.1A Digital data is represented by
abstractions at different levels.
2. EK 2.1.1B At the lowest level, all digital data are
represented by bits.
3. EK 2.1.1C At a higher level, bits are grouped to
represent abstractions, including but not limited
to numbers, characters, and color.
4. EK 2.1.1D Number bases, including binary,
decimal, and hexadecimal, are used to represent
and investigate digital data
24. Essential Knowledge:
• 5. EK 2.1.1E At one of the lowest levels of
abstraction, digital data is represented in binary
(base 2) using only combinations of the digits zero
and one.
• 6. EK 2.1.1F Hexadecimal (base 16) is used to
represent digital data because hexadecimal
representation uses fewer digits than binary.
• 7. EK 2.1.1G Numbers can be converted from any
base to any other base.
• 8. EK 2.1.2A A finite representation is used to
model the infinite mathematical concept of a
number.
25. Essential Knowledge:
• 9. EK 2.1.2B In many programming languages, the
fixed number of bits used to represent characters
or integers limits the range of integer values and
mathematical operations; this limitation can result
in overflow or other errors.
• 10.EK 2.1.2C In many programming languages, the
fixed number of bits used to represent real
numbers (as floating point numbers) limits the
range of floating point values and mathematical
operations; this limitation can result in round off
and other errors.
26. Essential Knowledge:
• 11. EK 2.1.2D The interpretation of a binary sequence
depends on how it is used.
• 12. EK 2.1.2E A sequence of bits may represent
instructions or data.
• 13. EK 2.1.2F A sequence of bits may represent
different types of data in different contexts.
• 14. EK 6.2.2J The bandwidth of a system is a measure
of bit rate—the amount of data (measured in bits)
that can be sent in a fixed amount of time.
• 15. EK 6.2.2K The latency of a system is the time
elapsed between the transmission and the receipt of a
request.
Hinweis der Redaktion
Lab 1: Number Representation:
This lab addreses the requirements of AP CSP Enduring Understanding 2.1.2, "Explain how binary sequences are used to represent digital data." (It does not cover hardware abstraction levels.) The first page introduces binary representation as a place value system just like decimal representation, but with only two digits (0 and 1) instead of ten (0 through 9). The second page explains how a sequence of bits can represent information other than integers, and in particular explains floating point as an approximation for real numbers. The third page introduces hexadecimal representation, which uses sixteen digits (0-9 and A-F), building on students' understanding of binary. On the fourth page, students learn to translate between hex and binary and about the use of hex in RGB colors. The last page is an optional project in which students build a decimal-to-binary conversion procedure based on and reviewing their work with base 2 representation
Goals for the Lab:
Page 1: Binary Representation.
Understand how numbers are stored in binary notation.
Understand how to translate numbers between binary and decimal notations.
Goals for the Lab:
Page 1: Binary Representation.
Understand how numbers are stored in binary notation.
Understand how to translate numbers between binary and decimal notations.
Goals for the Lab:
Page 1: Binary Representation.
Understand how numbers are stored in binary notation.
Understand how to translate numbers between binary and decimal notations.
Page 1: Binary Representation.
Don't try to teach students to do binary arithmetic. The goal is for students to learn to translate between representations.
Abstraction is one of the BIG IDEAS on the AP exam. BINARY IS ABSTRACTION because the pictures, words, program languages that you see are actually “1’s and 0’s in binary code.
Page 1: Binary Representation.
Don't try to teach students to do binary arithmetic. The goal is for students to learn to translate between representations.
Page 1: Binary Representation.
Don't try to teach students to do binary arithmetic. The goal is for students to learn to translate between representations.
Page 1: Binary Representation.
Don't try to teach students to do binary arithmetic. The goal is for students to learn to translate between representations.
Page 1: Binary Representation.
Don't try to teach students to do binary arithmetic. The goal is for students to learn to translate between representations.
Page 1: Binary Representation.
Don't try to teach students to do binary arithmetic. The goal is for students to learn to translate between representations.