Click to Get updated NTA UGC NET CS Test Series           Study Material for UGC NET Computer Science- 2019

# Digital Logic

## Decimal Numbering System

• The decimal numbering system has 10 digits 0 through 9
• The decimal numbering system has a base of 10 with each position weighted by a factor of 10 like

….105 104 103 102 101 100. 10-1 10-2 10-3 10-4 10-5

eg 14.2 = 1 X 101 + 4 X 100 + 2 X 10-1

## Binary Numbers

• The binary numbering system has 2 digits; 0 and 1

• The binary numbering system has a base of 2 with each position weighted by a factor of 2 like
….25 24 23 22 21 20 . 2-1 2-2 2-3 2-4 2-5

eg  10111 = 1 X 24 +0 X 23 +1 X 22 +1 X 21 + 1 X 20

## Decimal-to-Binary Conversion

Repeated division-by-2 method

Example: convert (68)10 to binary

68/2 = 34 remainder is 0
34/ 2 = 17 remainder is 0
17 / 2 = 8 remainder is 1
8 / 2 = 4 remainder is 0
4 / 2 = 2 remainder is 0
2 / 2 = 1 remainder is 0
1 / 2 = 0 remainder is 1

We stop here as the number has been reduced to zero and collect the remainders in  reverse order.
Answer = 1 0 0 0 1 0 0
Note: the answer is read from bottom (MSB, most significant bit) to top (LSB least significant bit) as (1000100)2 .

To convert a decimal fraction to its binary fraction, multiplication by 2 is carried out  repetitively and the integer part of the result is saved and placed after the decimal point.
The fractional part is taken and multiplied by 2. The process can be stopped any time after the desired accuracy has been achieved or we get all zeros after decimal
Example: convert ( 0.68)10 to binary fraction.
0.68 * 2 = 1.36 integer part is 1
Take the fractional part and continue the process
0.36 * 2 = 0.72 integer part is 0
0.72 * 2 = 1.44 integer part is 1
0.44 * 2 = 0.88 integer part is 0
The digits are placed in the order in which they are generated, and not in the reverse  order. Let us say we need the accuracy up to 4 decimal places. Here is the result.
Answer = 0. 1 0 1 0…..

## Octal Number System

• Base or radix 8 number system.
• 1 octal digit is equivalent to 3 binary bits.
• Octal numbers are 0 to7.

Conversion of octal to decimal

( base 8 to base 10)
Example: convert (635)8 to decimal
= (6 x 82) + (3 x 81) + (5 x 80
= (6 x 64) + (3 x 8) + (5 x 1)
= 384 + 24 + 5
= (413)10

Conversion of decimal to octal ( base 10 to base 8)

Example: convert (178)10 to octal equivalent
178 / 8 = 22 remainder is 2
22 / 8 = 2 remainder is 6
2 / 8 = 0 remainder is 2

Note: the answer is read from bottom to top as (262)8, the same as with the binary case.

Conversion of decimal fraction to octal fraction is carried out in the same manner as
decimal to binary except that now the multiplication is carried out by 8.
Example: convert (0.523)10 to octal equivalent up to 3 decimal places
0.523 x 8 = 4.184 ,its integer part is 4
0.184 x 8 = 1.472, its integer part is 1
0.472 x 8 = 3.776 , its integer part is 3
So the answer is (0.413..)8Conversion of decimal to binary (using octal)
When the numbers are large, conversion to binary would take a large number of division
by 2. It can be simplified by first converting the number to octal and then converting each
octal into its binary form:
Example: convert (177)10 to its binary equivalent using octal form
Step 1: convert it to the octal form first as shown above
This yields (2 6 1)8
Step 2: Now convert each octal code into its 3 bit binary form, thus 2 is replaced by 010,
6 is replaced by 110 and 1 is replaced by 001. The binary equivalent is
( 010 110 001)2
Example: convert (177.523)10 to its binary equivalent up to 6 decimal places using octal
form.
Step 1: convert 177 to its octal form first, to get (2 6 1)8 and then convert that to the
binary form as shown above, which is ( 010 110 001)2
Step 2: convert 0.523 to its octal form which is (0.413..)8
Step 3: convert this into the binary form, digit by digit. This yields (0.100 001 011…)
Step 4: Now put it all together
( 010 110 001 . 100 001 011…)2
Conversion of binary to decimal (using octal)
First convert the binary number into its octal form. Conversion of binary numbers to octal
simply requires grouping bits in the binary number into groups of three bits
•Groups are formed beginning with the Least Significant Bit and progressing to the MSB.
Start from right hand side and proceed to left. If the left most group contains only a
single digit or a double digit, add zeroes to make it 3 digits.
•Thus
11 100 1112
= 011 100 1112
= 3 4 78 And
1 100 010 101 010 010 0012
= 001 100 010 101 010 010 0012
= 14252218
Now it can be converted into the decimal form. Table 1

0 + 0 = 0  Sum of 0 with a carry of 0
0 + 1 = 1 Sum of 1 with a carry of 0
1 + 0 = 1 Sum of 1 with a carry of 0
1 + 1 = 10 Sum of 1 with a carry of 1

11001
+1101

100110

Binary Subtraction
0 - 0 = 0
1 - 1 = 0
1 - 0 = 1
0 - 1 = 1 (with a borrow of 1)
1011
- 111

100

X