unit 1.4.1 Flashcards
primitive data type
a data type provided by the programming language
chraracter
a single alphanumeric character
string
one or more alphanumeric characters
float/real
a number with a fractional part
ineger
a whole number
boolean
a binary (true false, 1 0) value
hex - advantages
easier for humans to read/remember, quicker for humans to read/write, easy to convert to deary
hex - uses
MAC addresses, colours (RGB), assembly and mahcine code
ASCII (American Standard Code for Information Interchange)
Each character is represented by a 7-bit binary code allowing for 128 characters, first 32 are control codes
extended ASCII
extra bit was added for extra characters
unicode
was introduced to standardise character encoding across languages, first 256 characters are identical to extended ASCII making it compatible with older documents
0+0
0
0+1
1
1+1
10
1+1+1
11
overflow error
occurs when the result of an operation exceeds the number of bits the computer works with
sign and magnitude
MSB is used to denote sign where 0 is positive and 1 is negative
two’s compliment
convert positive to binary, flip the bits, add 1
binary subtraction
done by adding the first number the the negative 2nd number in 2s compliment
unsigned - smallest posible
0
unsigned - biggest possible
(2^n)-1
unsigned - range
2^n
two’s compliment - smallest possible
-(2^(n-1))
two’s compliment - biggest possible
+(2^(n-1) - 1)
two’s compliment - range
2^n
sign and magnitude - smallest possible
-(2^(n - 1) - 1)
sign and magnitude - biggest possible
+(2^(n - 1) - 1)
sign and magnitude - range
(2^n) - 1
higher accuracy
lower range
normalisation - advantages
provides maximum precision