Data Representation
Data Representation
Data Representation
Number Systems
Bit (binary digit): The smallest unit of data in a computer; can use (0 or 1).
Logic gates: electronic devices that perform logical operations on binary data.
- Processes binary data: applies Boolean logic to input values to produce binary output.
more digits for same value. less digits for same value.
NOTE
1 nibble = 4 bits
1 byte = 8 bits
1. Denary to Binary
Example: 188
- Write down the powers of 2 from right to left, starting with 20, 21, 22 and so on (until
128 - as answers must be given in 8 bits)
128 64 32 16 8 4 2 1
- Starting from the leftmost column, write 1 if the corresponding power of 2 is less
than or equal to the number you’re converting; otherwise write 0.
128 64 32 16 8 4 2 1
1 0 1 1 1 1 0 0
- Check your work by adding together all the colum headings with 1. underneath;
128+32+16+8+4 = 188
- Write the binary digits from left to right to get binary equivalent of 188:
10111100
2. Binary to Denary
Example: 10111100
- Write down the powers of 2 from right to left, starting with 20, 21, 22 and so on (until
128 - as answers must be given in 8 bits)
128 64 32 16 8 4 2 1
- Starting from the leftmost column, write the binary digits in the columns.
128 64 32 16 8 4 2 1
1 0 1 1 1 1 0 0
3. Binary to hexadecimal
Example: 10111100
- Groups the binary digits into groups of 4, starting from the rightmost digit. (if there
are not enough digits to make a group of 4, add leading zeroes as needed)
- Add column headings to work out the value of each nibble (1 nibble = 4 bits)
8 4 2 1 8 4 2 1
1 0 1 1 1 1 0 0
- 8+2+1 = 11 8+4 = 12
- Replace each nibble with its corresponding hexadecimal value:
10 A
11 B
12 C
13 D
14 E
15 F
NOTE: numbers from 1-9 remain the same in hexadecimal.
- 11 = B; 12 = C
- Thus the corresponding hexadecimal value = BC
4. Hexadecimal to binary
Example: BC
- Separate each hex digit into groups of 4 bits (nibble)
8 4 2 1 8 4 2 1
8 4 2 1 8 4 2 1
1 0 1 1 1 1 0 0
- Thus the binary equivalent = 10111100
5. Denary to hexadecimal
- Turn your denary number to binary, and then turn the binary number to hexadecimal
6. Hexadecimal to denary
- Turn your hexadecimal number to binary, and then turn the binary number to denary.
Binary addition
- 0+0=0
- 0+1=1
- 1+1=10 (The 1 is carried into the next column on the left)
- 1+1+1=11 (The 1 is carried into the next column on the left)
Overflow
Explain why overflow error occurs
- A computer/device has a predefined limit it can represent or store, eg. 16-bit.
- An overflow error occurs when a value outside this limit should be returned.
- Overflow error occurs when result of a calculation is greater than 255 (in 8-bit register)
● Smallest number of bits that can be used to store the denary value 2000: 11
● Least number of bits that can be used to store the denary number 301: 9
● Least number of bits that can be used to store the hexadecimal value A4D: 12
Binary shifts
- Term used for multiplying/ dividing in binary.
- Binary shift moves all bits in a binary number a certain number of positions to left/ right.
- Bits shifted from the end of the register are lost and zeros are shifted in at the opposite
end of the register.
- Most significant bit(s) or least significant bit(s) are lost, according to the shift performed.
- The positive binary integer is multiplied or divided according to the shift performed:
Left shift = multiplication by a power of 2; Right shift = division by a power of 2.
NOTE: If we lose 1 bit during logical shift, we have exceeded maximum number of (left /
right) shifts possible using that register.
Effect that logical right shift of three places has on binary number
- The value becomes incorrect/inaccurate as the rightmost bits are lost
- (It is divided by 8) - only give this point if it’s for 2 marks
Most significant bits = leftmost bits = lost during logical left binary shift
Least significant bits = rightmost bits = lost during logical right binary shift
Two’s Complement
- A method of representing signed integers (positive & negative) in binary form
- The leftmost bit represents the sign (0 for positive and 1 for negative)
Complete the binary register for the denary number –78 (two’s complement)
- Binary register for +78 = 01001110
- Flip the 1s & 0s = 10110001
- Add 1: 10110010
HTML values
Red: FF 00 00
Green: 00 FF 00
Blue: 00 00 FF
Cyan: 00 FF FF
Magenta: FF 00 FF
Yellow: FF FF 00
Character set
- All the characters and symbols that can be represented by a computer system.
- Each character and symbol is assigned a unique value.
Representing sound
- Sound is a type of analog signal.
- Sound wave is sampled, for sound to be converted to binary & processed by a computer.
- Sampling involves taking measurements of the sound wave at regular intervals.
- These measurements are converted into binary data.
Accuracy of recording and file size increases as the sample rate and resolution increase.
Representing images
Image: series of pixels that are converted to binary, which is processed by a computer.
- Each pixel can be represented by a binary code, which is processed by a computer
Data storage
bit smallest unit of data in a computer (0 or 1).
1 nibble 4 bits
1 byte 8 bits
Calculating file size: NOTE: Calculations must use the measurement of 1024, NOT 1000.
Eg. A sound clip uses 48KHz sample rate, 24 bit resolution and is 30 seconds long.
- Sample rate = 48 x 10³ Hz
- Sample resolution = 24 bit
- Length of track = 30s
- No of bits = 48 x 10³ x 24 x 30
- No of bytes = (48 x 10³ x 24 x 30) / 8 = 4320000 bytes
- 4320000 bytes = 4.12 mebibytes
Data Compression
Reducing the file size.
Lossy compression
Reduces the file size by permanently removing data, e.g. reducing resolution or colour
depth, reducing sample rate or resolution.