L5 - INF 111 Intro To Informatics
L5 - INF 111 Intro To Informatics
The computer system (i.e. digital computers) are made up of logic that works only
with two binary digits “1” and “0” or ‘ON” and “OFF”.
Thus data and Information is stored in the computer in the form of the two binary
digits.
Definition of terms
Bits
Bits are binary digits consisting of “0” and “1” .
Bits are the basic unit of representing data and information in digital computers.
Byte
A group of bits used to represent a character. For example 8 bits represent one
character in ASCII Code,
Nibble
A nibble refers to half a byte i.e. consist of 4 bits.
Word
Word refers to two or more bytes.
NB: Word length or word size is used to measure the processor or register size in
hardware
architecture. E.g. 16-bit processor, 32 bit processor, 128 bit processor etc
NUMBER SYSTEMS
Decimal number system is base ten number system consisting of 10 (ten) digits
namely 0 to 9.
Example of base(radix) ten number:
718910
Positional values are increasing powers of the base as we move left and
decreasing powers of base as we move right.
e.g (7x103)+(1x102)+(8x101)+(9x100)
(7x1000)+(1x100)+(8x10)+(9X1)
7000+100+80+9= 718910
e.g (1x23)+(0x22)+(0x21)+(1x20)
8+0+0+1=910
10012=910
Solution
2 9
2 4–1
2 2–0 Therefore 910= 10012
2 1-0
Solution
2 45
2 22 – 1
2 11 - 0 Thus 4510=1011012
2 5–1
2 2–1
2 1- 0
For decimal numbers with fractions, the number is divided into two parts:
- The whole number
- The fraction number
The whole number part is converted to binary individually as above.
The fraction part is repetitively multiplied by two until the fraction becomes zero or
starts recurring.
Example1: Convert 9.2510 to binary
Solution
910 =10012
Solution
76.12510 = 1001100.0012
Assignment: Convert 7.562510 to binary (Ans=111.10012)
Convert 0.37510 to binary (Ans = 0.0112)
Convert 0.84375 10 to binary (Ans = 0.110112)
Solution:
23 22 21 20
1 0 0 1
(1x23)+(0x22)+(0x21)+(1x20)
8 +0 +0 +1 = 910
For binary numbers with fraction, the whole number is converted to decimal as above.
The fraction part digits are divided by multiples of two , starting from the decimal
point
24 23 22 21 20 2-1 2-2
1 1 0 1 0. 0 1
Solution:
5 2 6
101 010 110
5268 = 1010101102
Example 2: 1643528 to binary (Ans=0011101000111010102)
8 80
8 10 – 0 Thus 8010 = 1208
8 1- 2
Example 2: Convert 33010 to Octal
8 330
8 41 -2 Thus 33010 = 5128
8 5-1
The procedure to convert fractional decimal numbers to octal is also the same as that
of the fractional decimal numbers to binary but the multiplication of the fraction part
is by 8 instead of 2.
Example 1: Convert 20.2510 to octal
82 81 80
5 1 2
(82x5) +(81x1)+ ( 80x2)
(64x5)+(8x1)(1x2) = 33010
Example 2: Convert 15678 to decimal (Ans = 88710)
The fractional octal numbers are converted to decimal using the same procedure
as that of converting fractional binary numbers to decimal but the division is by
multiples of eight.
Example 1: Convert 142.18 to decimal
Solution
2 1
8 8 80 8-1
1 4 2. 1
(82 x1 )+(81x4)+(80x2)+(8-1x1)
142.18 =98.12510
7. Binary to Hexadecimal conversion
To convert a binary number to hexadecimal, follow the steps below:
a) Arrange the bits in groups of four starting from right
b) Then change each group of its hexadecimal equivalent
Solution
0001 1001 0001
1 9 1
Therefore 1100100012 = 19116
3 2 1
0011 0010 0001
Therefore 32116 =0011001000012
The procedure is the same as that of decimal to binary except that division is by
16
16 32
16 2-0 Thus 3210 = 2016
The procedure for convert fractional numbers to hexadecimal is also the same as
that of the fractional decimal numbers to binary, but multiplication is by 16
instead of 2.
161 160
4 0
(161 x4)+(160x0)
64 + 0 =64 Thus 4016=6410
CODING SCHEMES/SYSTEMS
2. Standard BCD
Standard BCD is a 6-bit representation scheme which can represent non-numeric
characters
Binary Arithmetic
1. Binary addition
2. Binary subtraction
3. Substraction using one’s complement
4. Substraction using two’s complement