Data representation-numbers and coding Flashcards
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
base 2
-so place values are increasing powers of 2
What is another word for decimal?
denary
What is the largest binary number which can be stored in any n bits?
2^n-1
What is the range of numbers which can be stored with 8 bits?
0..255
How many values can be stored using 8 bits?
256
includes zero
How many values can be stored using n bits?
2^n
including zero
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
- add one
- 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