3 - Fundamentals of Data Representation Flashcards
To not fail GCSEs
Number base
The number of unique digits available in a numbering system. E,g: In decimal these are 10 individual digits available (0,1,2,3,4,5,6,7,8,9), so it is also known as base 10
Computer binary
Computers use binary to represent all data and instructions. Whatever a user enters, be it number, text, image, sound, or video, it is ultimately stored as a string of 0’s and 1’s
Binary to decimal conversion
Use the table thing: 128 64 32 16 8 4 2 1
Place binary underneath and add to number
E.g: 11001010 = 202
since 128 + 64 +8 + 2 = 202
Decimal to binary conversion
Put 1 into biggest number it can go into, then do the same going down the 128 number thing
E.g: 85 = 01010101
Hexadecimal
One hexadecimal digit can always be translated to four binary digits. Hexadecimal is used as shorthand, since it is quicker to write and less prone to being misread
Hexadecimal examples table
Binary : Decimal : Hex
0000 : 0 : 0 0001 : 1 : 1 1001 : 9 : 9 1010 : 10 : A 1111 : 15 : F
To convert from binary to hexadecimal
- We’re gonna convert 011110 to decimal
- If binary number has a number of digits divisible by 4 (e.g: 4,8,12, etc) it can be left alone. Else add 0’s to left until the number of digits is div by 4. We add 2 0’s to left to our number
- Next split the number into ‘nibbles’ of four bytes each
- Finally convert each nibble separately, using the hex table
011110
00011110
0001 1110
0001 = 1
1110 = E
So 011110 = 1E
To convert hexadecimal to binary
- We’re gonna convert A6
- Each hex digit translate to binary nibble, use table
- Attach nibbles together
A6
A = 1010
6 = 0110
1010 0110
So A6 = 10100110
To convert between decimal and hexadecimal numbers
Best way is to go through a binary number
So either
- Decimal > Binary > Hex
Or
- Hex > Binary > Decimal
Bit (b)
A single binary digit // Either a single ‘1’ or ‘0’
Byte (B)
A sequence of 8 bits // An individual keyboard character such as ‘#’ or ‘k’
Kilobyte (KB)
Approx 1,000 bytes // A paragraph of text containing around 200 words
Megabyte (MB)
Approx: 1,000 KB or
1,000,000 B
// Around 1 min of average quality mp3 music
Gigabyte (GB)
Approx: 1,000 MB or
1,000,000 KB or
1,000,000,000 B
// About 90 mins of standard definition video
Terabyte (TB)
Approx: 1,000 GB or 1,000,000 MB or 1,000,000,000 KB or 1,000,000,000,000 B // Depending on quality - several hundred hours of video
Binary Shift
Moving values of a binary number left or right
a. 00011000 > Shift right 1 > 00001100
b. 00001100 > Shift left 2 > 00110000
Shifting loss/gain
When you shift left or right, any bits that ‘fall off’ the end are lost forever; any bits that join the number at the other end are always ‘0’
Shifting
Shift Left:
Shift 1: X2
Shift 2: X4
Shift 3: X8
Shift Right:
Shift 1: Div 2
Shift 2: Div 4
Shift 3: Div 8