Unit-3_SummaryNotes
Unit-3_SummaryNotes
Binary System
Place 27 26 25 24 23 22 21 20
Values 128 64 32 16 8 4 2 1
Denary System: In denary system, the base is 10. So it gets multiplied based on 10, such as 10, 100, 1000, 10000, etc...
Converting Binary to Denary: there is only one method, that is to use place values table.
00111100 = Denary?
128 64 32 16 8 4 2 1
0 0 1 1 1 1 0 0
32 + 16 + 8 + 4 = 60
0011,1100 = 60
Converting Denary to Binary: there are 2 methods, that is to use place values and division.
Division: 60 = 0011,1100
Place Values:
100 = Binary?
128 64 32 16 8 4 2 1
0 1 1 0 0 1 0 0
100 = 0110,0100
60 = Binary?
128 64 32 16 8 4 2 1
0 0 1 1 1 1 0 0
60 = 0011,1100
Binary Arithmetic
Binary Addition: in binary addition, we will have to carry 1 when we add 1 and 1. But we can also see overflow error
when we add 1 + 1+ 1.
0011,1100 + 0110,0100 = 1010,0000
1 1 1 1 1
0 0 1 1 1 1 0 0
0 1 1 0 0 1 0 0
1 0 1 0 0 0 0 0
100 = 0110,0100
-100 = 1110,0100
1 1 1
0 1 1 0 0 1 0 0
1 1 1 0 0 1 0 0
1 0 1 0 0 1 0 0 0
256 128 64 32 16 8 4 2 1 = 328 (or) -78 (overflow @ incorrect value)
Two’s Complement: In two’s complement, we will be converting the binary values to its opposite one. In two’s
complement, there are 2 methods.
1. Reverse Calculation
2. Place Values.
Reverse Calculation: In this one, first you’ve to find the binary value of a denary number. Then flip the binary value to the
opposite one, such as, if the value is 0 then it is converted to 1, if the value is 1 then it is converted to 0. After flipping the
binary values, we will add 1 to that value in order to get binary value which will represent negative denary value.
For example:
60 = - 60
128 64 32 16 8 4 2 1
0 0 1 1 1 1 0 0 = 60
1 1 carries
1 1 0 0 0 0 1 1 = flip
1 = add 1
1 1 0 0 0 1 0 0 = - 60
60 = 0011, 1100
-60 = 1100, 0100
1 1 1 1 1
60 = 0 0 1 1 1 1 0 0
-60 = 1 1 0 0 0 1 0 0
0 = 1 0 0 0 0 0 0 0 0 (overflow)
Binary Shifts: With Normal Binary Arithmetic and Two’s Complement, we know how to add or sub in binary system but for
multiply and division, we’ve to use binary shifts.
In binary shifts: there are 2 types: Logical & Arithmetic.
Logical Shifts: it is for positive denary numbers. When multiplying, we will shift our binary numbers from right to left (left
shifts) and when dividing, we will shift our binary numbers from left to right (right shifts).
For example:
20 = 0001, 0100 = 4 (22) = 80 (20 x 4 = 80) (left shift)
0 0 0 1 0 1 0 0
0 0 0 1 0 1 0 0 0 0 = 64+16 = 80
Activity 5
0011, 1010 * 23
0 0 1 1 1 0 1 0 = 58 x 8 = 464(Ans)
0 0 1 1 1 0 1 0 0 0 0 = 464 (overflow) (Ans)
0011, 1010 * 23 = 1101,0000 (Ans)
1001, 1101 / 24
1 0 0 1 1 1 0 1 = 157 / 16 = 9.8 (10)
0 0 0 0 1 0 0 1 1 1 0 1 = 9
Arithmetic Shifts: It will used for negative numbers. When multiplying, it will go left side (right to left) and dividing, it will
go right side (left to right). But when multiplying, it will replace the empty bits with zeros. When dividing, it will replace the
empty bits with ones.
Activity 6
Hexadecimal Numbers: In our digital system, we’ve binary, denary to represent numbers and data but we, human is hard
to remember 8 sets of zeros and ones, which is why ‘hexadecimal’ is invented. It is for human to use and to understand
more better at binary.
In our hexadecimal, we’ve total 16 values, which start from 0 and go up to 15.
Denary 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Hexadecim 0 1 2 3 4 5 6 7 8 9 A B C D E F 10
al
ASCII codes has 7 bits, so total characters it can represent is 128 characters but still it is not enough for other
language.
So, they created extended ASCII code which has 8 bits that represent 256 characters but each organization use
their own ASCII version. That’s why we don’t standardization. To overcome this, they created a Unicode which is
uniformed and it has 2 bytes or 4 bytes, which is 16 bits or 64 bits that can represent other languages.
We can also used binary to represent images and videos. In images and videos, it represent the colors with a
series of 0 and 1.
The quality of the image depends on the number of pixels and bit depth (color depth). The formula to calculate:
width * height * bit depth.
3. Chapter 14: Data Storage and Compression
Data Storage: There are 2 types of units that we use to represent data. They are Binary and Decimal Prefix.
Binary Prefix we also called it as a IEC unit (International Electrotechnical Commission) and Decimal Prefix, we
called it as SI unit (International System of Measurement).
Decimal Prefix
8 bits = 1 bytes
1000 bytes = 1 Kilobytes (KB)
1000 KB = 1 Megabytes (MB)
1000 MB = 1 Gigabytes (GB)
1000 GB = 1 Terabytes (TB)
Binary Prefix
8 bits = 1 bytes
1024 bytes = 1 Kibibytes (KiB)
1024 KiB = 1 Mebibytes (MiB)
1024 MiB = 1 Gibibytes (GiB)
1024 GiB = 1 Trebibytes (TiB)
Compression Algorithms: we’ve 2 types of it. Lossless and Lossy.
Lossless: it used mainly on the text which is documents and it uses a RLE (Run Length Encoding) Method to
compress.
Lossy: it mainly uses on the images, videos & audios.