1.4.1 Flashcards
data types (5)
Integer
Real/float
Boolean
Character
String
primitive data type
any basic data type provided by a language as a foundational building block
integer
represents any positive or negative whole number
real
real or float
any real world quantity as a number
floating point
real or float
any real world quantity as a number
character
represents a single character – this can be any alphanumeric character or symbol
string
represents a collection of characters
it can include any alphanumeric characters or symbols
boolean
represent one of two truth values associated with logic and Boolean algebra – typically, true or false
binary - sign and magnitude
first bit
0 = positive
1 = negative
binary - 2s complement
first bit
0 = positive
1 = negative
but if -ve then all other 1s are adding to the -ve first bit
subtraction of binary
e.g. 73 - 106 —-> 73 + -106 (use 2s complement)
hexidecimal
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
floating point in binary
always uses 2s complement
as you go –> along it halves
binary - mantissa
The number itself
binary - exponent
The position of the binary point in the number
(always uses 2s complement)
+ve decimal moves –> along
-ve decimal moves <– along
positive normalised binary starts with…
01
positive normalised binary starts with…
10
when +/- floating points
line up the decimal points
binary 1 bit left shift
doubles the number
binary 1 bit right shift
halves the number
binary shifts with signs
leave the first bit
if -ve pad with 1s not 0s
bitwise AND
only if both are 1
bitwise OR
if at least one is 1
bitwise XOR
only one is 1
AND mask
1s show the original
0s dont show the original
OR mask
1s will only show 1s
0s will show the original
XOR mask
1s will change each bit
0s will leave each bit the same
IP4 address
193 . 74 . 211 . 63
Character sets
agreed standards for referring to all the characters a computer can use
ASCII
American Standard Code Information Interchange
7 bits (128)
Extended ASCII
Extended American Standard Code Information Interchange
8 bits (256)
UNICODE
was 16 bit
now 24 bit