Fundamentals of Data Representation: Units of information - Bits and bytes
Bits and Bytes
editThe language that a computer understands is very simple, so simple that it only has 2 different numbers: 1 and 0. This number system is called Binary. This is because 1 represents high voltage and 0 to represent low voltage.
A 1 or 0 is called a Bit which is short for BInary DigiT. This is the fundamental unit of information.
Everything you see on a computer, images, sounds, games, text, videos, spreadsheets, websites etc. Whatever it is, it will be stored as a string of ones and zeroes.
Exercise: Bit patterns in a Computer How do computers store data? Answer: as binary values, using a pattern of 1s and 0s What sort of data can be stored in binary? Answer:
What does the following binary string represent: 10011100 Answer: This could be anything:
How many bits in a byte? Answer: 8, but it is originally the amount of bits used to represent a character How many bits in 7 bytes? Answer: 7 * 8 = 56
How many different patterns can be made from 4 bits?
Answer:
24 = 16 different patterns or combinations can be created
|
Minimum and Maximum Number vs. Number of Different Values
edit
From the Specification : Binary number System - Unsigned binary Know that in unsigned binary the minimum and maximum values for a given number of bits, n, are 0 and 2n -1 respectively. |
A common question that you'll need to know the answer to, and one that many people get wrong, is a question about the minimum and maximum denary value you can store in a set number of binary digits.
If I were to have 3 binary digits, the minimum value I could store would be 0002 = 0. Whereas, the maximum value that I could store would be 1112, this equates to 4 + 2 + 1 = 710. So for 3 binary digits the range of numbers I can store is 0 (minimum) to 7 (maximum).
From the Specification : Units of information - Bits and bytes Know that the 2n different values can be represented with n bits. |
A similar, but different question, is how many different binary patterns (and therefore values) can you represent with a set number of binary digits. If I were to be asked how many binary patterns can be represented from 3 binary digits, then we have 8 options:
# 000 # 001 # 010 # 011 # 100 # 101 # 110 # 111
We could count these all out and write down: "There are 8 different values 3 binary digits can take". But this isn't very clever, what is you wanted to find out the range and maximum values for 34 bits, you can't be expected to write them all out.
We are looking for a rule to save us the job and stop us making mistakes. Can you work out a rule in terms of for:
Maximum denary value of binary digits:
Rule: | ||
Maximum denary value = For example, for 3 digits: As calculated previously |
Number of different values/binary patterns for binary digits:
Rule: | ||
Number of values = For example, for 3 digits: As calculated previously |
Example
edit2 bits can be configured in 22 = 4 different ways. 3 bits can be configured in 23 = 8 different ways.
2 bits | 3 bits |
---|---|
00
01 10 11 |
000
001 010 011 100 101 110 111 |
Min = 0 | Min = 0 |
Max = 22-1 = 3 | Max = 23-1 = 7 |
22 = 4 | 23=8 |
4 combinations | 8 combinations |
Exercise: Max and range of binary numbers Give both the maximum value and number of different values for the following n binary digits: 4 Answer: Maximum : Range : 5 Answer: Maximum : Range : 8 Answer: Maximum : Range : 10 Answer: Maximum : Range : For an address bus with 6 wires, what is the highest address that can be given? How many addresses can accessed? Answer: highest address : Different number of addresses : This is a very popular exam question! |