- Computer understands only 0’s and 1’s
Booleans – means representing in 1’s and 0’s –
1- Is True value
0- Is False value.
AND , OR , NOT – operators
Same as Number can be represented 0-9
+,-,*,/ – operators
2+3=5 (2,3 are called operands , 5 is called result )
XOR -EXclusive OR
Boolean AND Boolean OR Boolean NOT Boolean XOR
operation operation operation operation
1 AND 0 = 0 1 OR 0 = 1 NOT 1 = 0 1 XOR 0 = 1
1 AND 1 = 1 1 OR 1 = 1 NOT 0 = 1 1 XOR 1 = 0
0 AND 1 = 0 0 OR 1 = 1 0 XOR 1 = 1
0 AND 0 = 0 0 OR 0 = 0 0 XOR 0 = 0
True AND False = False T OR F = T NOT True = False
True AND True = True T OR T = T NOT False = True
0 AND 1 = 0 F OR T = T
0 AND 0 = 0 False OR False = F
Numbering System
Decimal
Decimal is a number representation system using numbers (0 – 9)
e.g 64 is a decimal number.
24993
Binary representation
Binary number system is a number representation system using numbers (0 and 1)
- Eg. 1110,
bit – the zeros and ones in the binary number is called bit
e.g How many bits are in the binary number 1110 – ans: 4bits
How many bits are in the binary number 101010– ans: 6bits
- Common way of representing binary numbers is in 8bits
o Minimum binary number using an 8 bit is (00000000)
o Maximum binary number using an 8 bit is (11111111)
Ex: Rewrite the binary number 1110 in an 8bit binary representation
Ans: 00001110
Rewrite the binary number 101010 in an 8bit binary representation.
Ans: 00101010
An 8 bit number is called byte
That means 1byte = 8bit
1 killo byte (1KB) = 1,000 byte = 8000bit
1 Mega byte (1MB)=1,000,000 byte=8,000,000bit
1 Giga byte (1GB)=1,000,000,000 byte=8,000,000,000bit
1 Tera byte(1TB)=1,000,000,000,000 byte=8,000,000,000,000bit
Converting Decimal to binary is just diving by 2 until we get all 1’s and 0’s
e.g 5 = 101 in binary
Converting Binary to Decimal
- any number to the power of zero is equal to 1 (e.g 10^0 =1, 2^0= 1, 16^0=1)
- any number to the power of one is the number itself (e.g 10^1=10, 2^1=2,7^1=7)
10^2 = 10*10=100
10^3= 10*10*10=1000
2^1 = 2
2^2= 2*2 = 4
2^3=2*2*2= 8
2^4= 2*2*2*2=16
2^5 = 2*2*2*2*2 = 32
8^2=8*8 = 64
8^3=8*8*8= 512
e.g.
Decimal Binary
100’s 10’s 1’s 16’s 8’s 4’s 2’s 1’s
10^2 10^1 10^0 2^4 2^3 2^2 2^1 2^0
2 6 3 1 0 1 1 1
Decimal 2*100 + 6*10 + 3*1 = 200+60+3 = 263
Converting binary number 10111 to decimal
1*16 + 0*8 + 1*4 + 1*2 + 1*1 = 16+0+4+2+1 = 23
There for binary 10111 is equal to decimal 23
Homework: change decimal number 263 to binary
Ex 2 Change binary number 11101 to decimal
1*16 + 1*8 + 1*4 + 1*0 + 1*1 = 16 + 8 + 4 + 1 = 29
Homework: change the binary number 110011101 to decimal