Integer
Whole number, including zero and negative numbers, without a fractional part
Real
Positive or negative numbers which can have a fractional part, can also be represented using floating point
Character
Single symbol used by a computer, including letters A-Z, 0-9, %^& etc.
String
Collection of characters, useful for storing text and phone numbers starting with 0
Boolean
Values are restricted to True and False, useful for something that can only take 2 values
Binary addition of
1011
+1110
————
11001
Sign magnitude
0 means it’s positive, 1 means it’s negative
e.g. 010101101 is 173, but 110101101 is negative
Two’s complement
Makes the most significant bit negative. E.g. for 8 bits, 128 becomes -128. To convert from positive to two’s complement, flip all the bits and add 1. E.g. 00000111 is 7, which flips to 11111000, add 1 is 11111001, so if the most significant is -128, that means its -128 add the rest, which is -7
Two’s complement for subtraction
Convert them both into two’s complement (flip the bits and then add 1), and then add them together as normal.
Decimal to Hexadecimal
0123456789 10 11 12 13 etc.
0123456789 A B C D etc.
Floating point numbers in binary
Think of it as 6.67×10-11
Split into the mantissa and the exponent, where 6.67 is the mantissa and the exponent is -11