Flashcards in Data representation-numbers and coding Deck (59):
What is binary?
A number system which uses only two digits, 0 and 1
What is a bit?
One binary digit
(can be one or zero)
What is a byte?
A group of 8 bits
What is a word?
A group of bytes
(word size depends on the type of computer e.g. 8 byte machine has an 8 byte word size)
What is a denary number system?
A number system which uses the digits 0..9
(like our own number system)
What does a number base specify?
How much each digit is multiplied as you move from right to left
What base does the binary system have?
What does this mean
-so place values are increasing powers of 2
What is another word for decimal?
What is the largest binary number which can be stored in any n bits?
What is the range of numbers which can be stored with 8 bits?
How many values can be stored using 8 bits?
How many values can be stored using n bits?
What is twos complement?
A system for representing negative binary numbers
In twos complement, how can you tell if the number represented is negative?
It will start with a one
How would you convert a negative decimal number to twos complement?
-Make the decimal number positive
-Convert this to binary
-change all the ones to zeros and the zeros to ones
-add one to the result
How do you change the sign of a binary number?
-start from the right
-leave all digits up to and including the first one
-change all other ones to zeros and zeros to ones
What is the first method of converting a negative twos complement number to denary?
-flip the bits
-convert the binary to denary
What is the second method of converting a negative twos complement number to denary?
Add all the place values with a one underneath them.
The leftmost place value will always have a negative value
What is the best method for binary subtraction?
Converting the number to be subtracted to negative twos complement and then adding the two
How is -1 represented in twos complement?
With a one in all the place values
(for any number of bits)
What is the most significant bit (MSB)?
The leftmost bit (bit with the largest value)
What is the least significant bit (LSB)?
The rightmost bit (bit with the smallest value)
What is hexadecimal?
A number system which uses the digits 0..9 and letters A..F
What is hexadecimal used for?
Making binary more convenient for humans to read
-a shorthand for binary number patterns
What base does hexadecimal use?
How do you convert hexadecimal to binary?
Each symbol of hexadecimal has a value of 4 bits of binary. convert each symbol and put these groups together in the same order as the hexadecimal to form a longer binary number
What is 10 in binary and hexadecimal?
What is 15 in binary and hexadecimal?
How can real (non-integer) numbers be represented using binary?
With fixed point binary numbers
How does a fixed point binary number work?
The halving of place values continues on after a set place for the (imaginary) decimal point
8 4 2 1 . 1/2 1/4 1/8 1/16 etc
Is binary or decimal representation of fractions more precise?
What does fixed point binary notation assume?
That the binary point is always in a set position as there is no third symbol which can be used to literally store it
What are the most well known coding systems?
ASCII and unicode
What is a coding system?
Used to store text in computer memory
Each character is represented using a different binary pattern
How many different patterns (possiblities) are needed to represent all characters on a computer keyboard?
How many bits are needed to represent every symbol on a computer keyboard?
How many bits are needed to represent 128 values?
How is a character represented in ASCII?
A 7 bit binary integer
(with an 8th parity bit)
What is unicode?
A coding system which uses 16 bits to represent characters
(allowing for more symbols than ASCII)
What is a parity bit?
One bit added on to the end of a bit pattern to check for errors
How does even parity work?
The parity bit in the pattern is set to either a one or a zero to make the total number of 1s is an even number
If an odd number of 1s is receiver then there was an error in transmission
How does odd parity work?
The parity bit in the pattern is set to either a one or a zero to make the total number of 1s an odd number
If an even number of 1s is receiver then there was an error in transmission
Why is data not always correct even if the parity bit looks correct?
If an even number of errors occurs then the parity bits system will not detect any errors
What is the majority vote method?
Sending the same data three times and using the pattern which appears the most times
What is a disadvantage of the majority vote system?
It is very expensive as three times as much data has to be transmitted
What is hamming code?
A system which can self correct single errors using multiple parity bits in a bit pattern
How does Hamming code work?
All bit positions that are powers of 2 are used as parity bits, all other positions are used for encoding data to be sent
Each parity bit checks, from itself onwards, alternate bit sets the size of its position value
ie 2=check 2, skip 2, check 2 etc
Why is Hamming code often still used today?
It has a good balance between error correction and detection
How is an error located using Hamming code?
The position value of the error is the sum of the parity bits with wrong sections
(if the error is on a parity bit this is its value+0, so just the parity bit)
How many errors can hamming code detect/correct?
It can detect two bits and correct one bit
What happens when there is more than one error in hamming code?
The position values will add up to more than the range of the code
What is gray code?
Binary code where two consecutive values are only one bit different from each other
(even when the maximum value resets to zero)
What is the full name of gray code?
Binary reflected gray code
Why is gray code used?
In slow systems as the state changes a different number could be picked up before all of the bits have been changed
This cannot happen with gray code so data is more reliable
What can gray code be used for?
Angular movement systems where angular positions have to be known
How is a gray code counters output different from a pure binary counters output?
It toggles only one output bit at a time whereas a pure binary counter could toggle more
What is the advantage of gray code counters over equivalent standard binary counters?
They consume half of the electrical power
How many numbers can be represented by 4 bit gray code?