0% found this document useful (0 votes)
40 views10 pages

L5 - INF 111 Intro To Informatics

Uploaded by

amosjumah71
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views10 pages

L5 - INF 111 Intro To Informatics

Uploaded by

amosjumah71
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

L4: INF 111: Introduction 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,

NB: A byte is the basic unit of measuring memory size in computers.

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

Reasons for using binary system in computers


(i) It is easier to develop devices that understand binary language.
(ii) Devices designed using binary logic are more reliable than analog devices.
(iii) Digital devices are small in size and consume less energy

NUMBER SYSTEMS

Number systems are classified into major categories namely:


1. Decimal number system
2. Binary number system
3. Octal number system
4. Hexadecimal number system
1. Decimal number system/Denary number system

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

2. Binary number system


Binary number system consist of two digits namely 1 and 0 .
Thus binary number system uses a base of two
Example of base two(binary) number:
10012
The place value of binary numbers increases by factors of two to the left and
decreases power of base to the right.

e.g (1x23)+(0x22)+(0x21)+(1x20)
8+0+0+1=910
10012=910

3. Octal number system


Octal number system consists of eight digits ranging from 0 to 7.
Thus Octal number system uses base eight
Example of octal number :
258

4. Hexadecimal number system


Hexadecimal number system consist of sixteen digits ranging from 0 to 15.
Sixteen used in this system are decimal digits 0 to 9 and the alphabets A to F for
digits 10 to 15 as shown below:
Decimal Hexadecimal
10 A
11 B
12 C
13 D
14 E
15 F

NUMBER SYSTEM CONVERSIONS


The following conversions will be considered:
1. Decimal to binary conversion
2. Binary to decimal conversion
3. Binary to Octal conversion
4. Octal to Binary conversion
5. Decimal to Octal conversion
6. Octal to Decimal conversion
7. Binary to Hexadecimal conversion
8. Hexadecimal to binary conversion
9. Decimal to Hexadecimal conversion
10. Hexadecimal to decimal conversion

1. Decimal to binary conversion


To convert a decimal integer to binary, divide the decimal repetitively by 2 until
the dividend(2) is less than the divisor.

Example1: Convert 910 to binary

Solution
2 9
2 4–1
2 2–0 Therefore 910= 10012
2 1-0

Example 2: Convert 4510 to binary Assignment:


Convert 15710 to binary
(Ans=100111012)

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

Convert the fractional part:


Read this digits
0.25 x 2 =0.50
0.50 x 2 = 1.00

Therefore 9.2510 = 1001.012

Example 2: Convert 76.12510 to binary

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)

2. Binary to decimal conversion


To convert a binary integer to decimal number, add the weights of the non-zero
positions of the binary number.

Example 1: Convert 10012 to decimal

Solution:

23 22 21 20
1 0 0 1

(1x23)+(0x22)+(0x21)+(1x20)
8 +0 +0 +1 = 910

Example 2: Convert 11112 to decimal (Ans =1510)


Convert 1101110012 to denary (Ans=21710)

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

Example 1: Convert 11010.012 to decimal


Solution

24 23 22 21 20 2-1 2-2
1 1 0 1 0. 0 1

(1x24)+(1x 23)+(0x22)+(1x21)+(0x 20)+(0x2-1)+(1x2-2)


16 + 8 + 0 + 2 + 0 + 0 + 0.25 = 26.2510

Example 2: Convert 111.0112 to decimal (Ans = 7.37510)


Convert 0.110112 to decimal (Ans =0.8437510)

3. Binary to Octal Conversion


To convert a binary number to octal, follow the steps below:
a) Arrange the bits in groups of three starting from the right.
b) Change each group to its octal equivalent

Example 1: Convert 110100012 to Octal


Solution:
011 010 001
3 2 1

Therefore 110100012 =3218

Example 2: Convert 110110102 to Octal ( Ans=3328)


Convert 10110001111011112 to octal (Ans = 1307578)

4. Octal to Binary conversion


To convert to an octal number to binary, convert each octal digit into binary using
groups of three bits.

Example 1: Convert 5268 to binary

Solution:
5 2 6
101 010 110

5268 = 1010101102
Example 2: 1643528 to binary (Ans=0011101000111010102)

5. Decimal to Octal conversion


The procedure of converting a decimal number to octal is the same as the
conversion from decimal to binary, with a difference that repetitive division is
done by 8 instead of 2.
Example 1: Convert 8010 to Octal

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

Example 3: Convert 78910 to Octal ( Ans =142510)

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

2010 =248 and 8x0.25=2.0 Thus 20.2510=24.208

Example 2: Convert 96.8437510 to octal


Solution
9610=1408 and 8x0.84375= 6.75
8x 0.75 = 6.0

6. Octal to Decimal conversion


To convert an octal number back to decimal, simply add the weights of non-zero
positions of the octal number

Example 1: Convert 5128 to decimal

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

Example 1: Convert 1100100012 to hexadecimal

Solution
0001 1001 0001
1 9 1
Therefore 1100100012 = 19116

Example 2: Convert 10110001111011112 to hexadecimal


Solution
1011 0001 1110 1111
B 1 E F
Therefore 10110001111011112 =B1EF16

8. Hexadecimal to binary conversion


To convert hexadecimal numbers to binary, convert each hex digit into binary
individual using groups of four bits.

Example 1: Convert 32116 to binary


Solution

3 2 1
0011 0010 0001
Therefore 32116 =0011001000012

Example 2: Convert A916 to binary


Solution
A 9
1010 1001
A916 =1010110012

Example 3 Convert 5E616 to binary (Ans = 010111001102)

Example 4 Convert BAD16 to binary (Ans = 1011101011012)


9. Decimal to Hexadecimal conversion

The procedure is the same as that of decimal to binary except that division is by
16

Example 1: Convert 3210 to hexadecimal


Solution

16 32
16 2-0 Thus 3210 = 2016

Example 2: Convert 15010 to hexadecimal (Ans 15010=9616)

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.

Example 1: Convert 64.12510 to hexadecimal (Ans 6410=40.216)

Example 2: Convert 298.3437510 to hexadecimal (Ans 298.3437510 =12A.5816)

10. Hexadecimal to decimal conversion

To convert an hexadecimal number back to decimal, simply add the weights of


non-zero positions of the hexadecimal number
Example 1: Convert 4016 to decimal
Solution

161 160
4 0
(161 x4)+(160x0)
64 + 0 =64 Thus 4016=6410

Example 2: Convert ABCD16 to decimal (Ans =4398110)


Example 3: Convert 96.5816 to decimal (Ans = 150.3437510)

CODING SCHEMES/SYSTEMS

Coding is the process of representation of numeric or non-numeric information in


terms of binary digits.

The most common coding schemes are:


1. Binary Coded Decimal (BCD)
2. Standard BCD
3. American Standard Code for Information Interchange (ASCII)
4. Extended Binary Coded Decimal Information Interchange Code (EBCDIC)

1. Binary Coded Decimal (BCD)


Binary Coded Decimal is a 4-bit code used to represent numeric data only.

2. Standard BCD
Standard BCD is a 6-bit representation scheme which can represent non-numeric
characters

3. American Standard Code for Information Interchange (ASCII)


ASCII is a 7-bit coding scheme, with an 8th bit added to it for parity check
(error check). Hence ASCII is a 8-bit coding scheme.

4. Extended Binary Coded Decimal Information Interchange Code


(EBCDIC)
EBCDIC is a 8-bit code with a 9th bit added to it for parity check

Binary Arithmetic
1. Binary addition
2. Binary subtraction
3. Substraction using one’s complement
4. Substraction using two’s complement

You might also like