Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Chapter 2 Data Representation and Boolean Algebra

Why is binary language or machine language required?


A computer operates on electricity and any electronic can understand only two states – ON and OFF ( High
Voltage and Low Voltage ). So it needs a language with two symbols to represent these two states, which is
termed as binary or machine language

Number System Base Symbols used


Binary 2 0, 1
Octal 8 0, 1, 2, 3, 4, 5, 6, 7
Decimal 10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Hexadecimal 16 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

Base of a number system: The number of symbols used in a number system is called base or radix of a
number system MSD ( Most Significant Digit ) and LSD (Least Significant Digit ) : Left most digit of a
number is MSD and right most digit of a number is LSD.
A Word is a fixed-sized group of bits that are handled as a unit by a processor. Word length is the number of
bits in a word. Some word lengths are 8,16,32 and 64.
Binary Addition:
Rules for adding two bits: Binary Subtraction

A B Sum Carry A B Difference Borrow


0 0 0 0 0 0 0 0
1 0 1 0 1 0 1 0
0 1 1 0 0 1 1 1
1 1 0 1 1 1 0 0

Integer representation methods:


(i) Sign and magnitude representation : Here MSB is used for sign ( 1 for positive and 0 for negative ) and
remaining 7 bit is used for representing magnitude of the number.
Ex. +23 can be represented as -75

1 1 0 0 1 0 1 1
0 0 0 1 0 1 1 1 sign Magnitude
sign Magnitude
represented as

In a 8 bit word, numbers from -127 [( 1 1111111)2 ] to +127 [ ( 0 1111111) 2 ] can be represented. Then 0
(zero) can be represented in two ways , +0 = 00000000 and -0 = 10000000 .
(ii) 1’s complement representation : To find the complement of a binary number ( 8 bit word form), just
replace every 0 with one and every 1 with 0 .
➔ For positive numbers, 1's complement is the binary equivalent of the number itself.
➔ For negative numbers , find the binary equivalent and exchange every 1 and 0.
Ex. Represent -38 in 1's complement form.
Binary equivalent of 38 in 8 bit form is ( 0 0 1 0 0 1 1 0 )2
-38 in 1's complement form is ( 1 1 0 1 1 0 0 1 )2
Represent +55 in 1's complement form.
Binary equivalent of 55 in 8 bit form is ( 0 0 1 1 0 1 1 1 )2 .
There is no need to find 1's complement of a positive number, +55 in 1's complement form is the binary
equivalent itself.
In a 8 bit word, numbers from -127 [( 1 0000000)2 ] to 127 [ ( 0 1111111) 2 ] can be represented. Then 0
(zero) can be represented in two ways , +0 = 00000000 and -0 =11111111 .

(iii) 2’s complement representation : 2's complement of a number is calculated by adding 1 to its 1's
complement ( 8 bit word form ). For a positive number, 8 bit binary equivalent is the 2's complement.
For a negative number, write it as 2's complement form.
Representation of Real ( floating point ) number: Any number represented in this form contains two
parts, mantissa and exponent.
Ex. 73.456 can be written as 0.73456 X 103. Here 0.73456 is the mantissa and 3 , (power of ten ) is the
exponent.

SIGN SIGN

Mantissa (24 bit ) Exponent ( 8 Bit )

Real number is represented in 32 bit word length computer. (Word length may changes ).

Subtraction using complements.


(a). using 1's complement: i) . place 0s to the left of smaller number so that the 4
Minuend A—
number of bits in two numbers are same. ii). Add 1's complement of subtrahend with Subtrahend B
minuend. iii). Add the carry 1 to the sum.

Example 1: 10101 – 00111


We take 1's complement of subtrahend 00111, which comes out 11000. Now, sum them. So,
10101+11000 =1 01101.
In the above result, we get the carry bit 1, so add this to the LSB of a given result, i.e., 01101+1=01110,
which is the answer.

Eg. 10110— 10110— 10110 + 0 1 0 1 1 +


1010 01010 10101 1
101011 1 1 0 0
1

( find 1's complement )


(b). using 2's complement:
i) . place 0s to the left of smaller number so that the number of bits in two numbers are same. ii). Find 2's
complement of subtrahend. iii) add the 2's complement with minuend. iv). Ignore the carry.
Eg.
1's complement of the subtrahend (01010 ) is 10101.
10110— 1 0 1 1 0 — 2's complement of subtrahend is
1010 01010 101 0 1 +
1
1 01 1 0
Add with minuend
Ignore the carry.
10110 + So the Answer is ( 1100 )2
ie. 22 —
10110
10
101100
12

Representation of characters:
ASCII ( American Standard Code for Information Interchange ). It uses 7 bits to represent a character in
computer memory. It can represent only128 characters. Another version is ASCII-8 uses 8 bits for each
character, can represent 256 different characters.
EBCDIC ( Extended Binary Coded Decimal Interchange Code ). This is similar to ASCII and is an 8 bit
code. It can represent 256 characters.
ISCII ( Indian Standard Code for Information Interchange or Indian Script Code for Information
Interchange ). It uses 8-bits and can represent various writing systems of India.
Unicode: Originally used 16 bits which can represent up to 65,536 characters. Nowadays Unicode uses more
than 16 bits and hence it can represent more characters. The Unicode Standard provides a unique number for
every character, no matter what platform, device, application or language . Unicode can represent characters
in almost all written languages of the world.
Boolean Algebra: It is the algebra of logic. It deals with the operations on variables that represent the values
1 and 0. The variables which can store logical constants 1 and 0 are called logical variables or boolean
variables.
Boolean operations: The operations performed on the Boolean values 0s and 1s. The operations are OR
(Logical Addition), AND (Logical Multiplication), NOT (Logical Negation).
Logic gate: It is a physical device that can perform logical operations on one or more logical inputs and
produce a single logical output. . (Logic gates are primarily implemented using diodes or transistors acting
as electronic switches. )
Truth Table: It is a table that shows Boolean operations and their results.
The OR operator and OR gate.
The OR operator performs logical addition and the symbol used for this operation is + (plus). The
expression A + B is read as A OR B.
Truth table of OR operation
The symbol of logical OR gate

A B A+B
0 0 0
0 1 1
1 0 1
1 1 1
The AND operator and AND gate. 5
The AND operator performs logical multiplication and the symbol used for this operation is ● (dot).
The expression A ● B is read as A AND B.

Truth table of A ● B
A B A●B
The symbol of logic AND gate 0 0 0
0 1 0
1 0 0
1 1 1

AND gate with three input

Inverter or NOT gate


The NOT operator and NOT gate: A A'
A A'
1 0
0 1

Basic postulates of Boolean Algebra

1). Principles of 0 and 1 : If A ≠ 0, then A=1 and if A ≠ 1, then A=0.


2). OR operation (Logical addition) :
0 + 0 = 0, 0 + 1 = 1, 1 + 0 = 1, 1 + 1 = 1
3). AND operation (Logical Multiplication ):
0 . 0 = 0, 0 . 1 = 0, 1 . 0 = 0 , 1 . 1 = 1
4). NOT operation (Logical Negation or Complement Rule ): 0' = 1, 1'= 0

Principle of duality: For a Boolean statement , there exists its duel form which can be derived by
changing each OR sign( + ) to AND sign ( . ) , AND sign to OR sign, and replace 1 to 0, 0 to 1.

Basic theorems of Boolean Algebra.


Identity law: For a boolean variable X, then 1 X 1+ X 1.X
0 + X = 0, 1 + X =1, 0 . X = 0, 1 . X = X
1 0 1 0
0 X 0+X 0.X 1 1 1 1
0 0 0 0
0 1 1 0

Idempotent Law : For a boolean variable X, then a). X + X = X, X.X=X

X X X+X X.X
0 0 0 0
1 1 1 1
X =X

Associative law : Let X , Y and Z are any three Boolean Variables, then
X+(Y+Z)=(X+Y) +Z, X.(Y.Z)=(X.Y) .Z

X Y Z X+Y Y+Z X+(Y+Z) (X+Y)+Z X .Y Y. Z X.(Y.Z) (X.Y).Z


0 0 0 0 0 0 0 0 0 0 0
1 0 0 1 0 1 1 0 0 0 0
0 1 0 1 1 1 1 0 0 0 0
0 0 1 0 1 1 1 0 0 0 0
1 1 0 1 1 1 1 1 0 0 0
1 0 1 1 1 1 1 0 0 0 0
0 1 1 1 1 1 1 0 1 0 0
1 1 1 1 1 1 1 1 1 1 1
De Morgan's theorems:

1). X+Y = X • Y or ( X + Y)| = X| • Y|

2). X • Y = X + Y or (X • Y )| = X| + Y |

Universal gates: A universal gate is a gate which can implement any Boolean function without need to
use any other gate type. The NAND and NOR gates are universal gates. ( In practice, this is advantageous
since NAND and NOR gates are economical and easier to fabricate and are the basic gates used in all IC
digital logic families.)
NAND gate: A NOT gate followed by an AND gate makes a NAND gate. The logic gate which performs
this NAND operation is called NAND gate. . The logical construction of the NAND gate is shown below,

NOR gate: NOR gate means NOT OR gate. A NOR gate is an inverted OR gate. The logic gate performs
this operation is called NOR gate. The basic logic construction of the NOR gate is shown below,

NOT gate
OR gate NOR gate
Implementations of Basic gates using NAND, NOR gates.
NOT gate using NAND gate:
A.A = A
A A.A (A.A)' A'
0 0 1 1
1 1 0 0
AND gate using NAND gate:

A A.B
A.B

A
OR gate using NAND gate:
A.B =A+ B
B

NOT gate using NOR gate:


A A +A (A +A)' A'
0 0 1 1
1 1 0 0

A' AND gate using NOR gate

A+B =A.B

B'

Implementing OR gate using NOR gate

The three Basic gates and their symbols


Distributive Law: Let X , Y and Z are any three Boolean Variables, then
X.(Y+Z)=(X.Y) +(X.Z), and X+(Y.Z)=(X+Y) .(X+Z)

X Y Z Y+Z X . (Y + Z) X.Y X.Z X.Y+X.Z


0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0
0 1 0 1 0 0 0 0
0 0 1 1 0 0 0 0
1 1 0 1 1 1 0 1
1 0 1 1 1 0 1 1
0 1 1 1 0 0 0 0
1 1 1 1 1 1 1 1

(All others are left for exercise )

Questions
1. ASCII_8 is able to represent 256 characters. If we want to represent more characters we have to use
........ ( Unicode )
2. ASCII stand for-------------------- (American Standard Code for Information Interchange )
3. Find the MSD, LSD in the decimal number 123.45 ( 1)
4. Find the next term in the series. 10102, 101002 , 111102, ----,
5. Number of symbols used in a number system is called .............. (radix or base )
6. Pick invalid number from the following ( (1010)8 , (123)4, (768)8, ( ABC)16 )
7. A logic circuit is made up of individual units called ----------- (gate . gate represent a boolean
operation)
8. Name the logical operator / gate which gives high output if and only if all the inputs are high.
(AND)
9. Write 28.57 in mantissa exponent form. (0.2857 X 102 or 0.2857 E2, where 0.2857 is the
mantissa and 2 is exponent )
10. Fill the series (151)8, (153)8 , (155)8, --------- , ---------- .
11. Convert (400)10 into binary, Octal, Hexadecimal number system.
12. Which is the software used for calculations (Word processor, Spread sheet, Presentation,
Multimedia )
13. Write the two's complement form of the decimal number -119
14. convert (111.011)2 into decimal form.
15. List some file formats for storing image, sound and video data ?
(.jpg, .bmp, .gif. .wav, .mp3, .midi. .avi, .mp4 )
16. Draw the logic circuit for the boolean expression ( A+ B.C ) + A.B
17. How can we construct AND gate, OR gate, NOT gate using NAND gate?
18. Draw the logic symbol of OR, AND, NOT gate?
19. Write the duel expression of X .( Y + Z ) = X . Y + X . Z ?
20. Write and prove De Morgan's theorem ?
21. What is the relevance of hexadecimal system in computers?
(The numbers representing in binary form requires too many bits need a lot of effort. Binary can be
easily converted into hexadecimal. So Hexadecimal is used in the design and operations of
electronic circuits. )
22. Write all the possible number system each number can belong to a). 1011 b). 567 c). 649 d).
5B
23. How many rows are required in a truth table if the boolean expression has three input variables?
a). 3 b). 6 c). 8 d). 9
24. If ( 92) X= ( 222 ) Y then find X and Y ? ( X=16, Y=8)
25. Name the encoding system for encoding characters that was developed by Department of Electronics,
Govt. Of India. What was the purpose of this encoding scheme? Write its features?
( ISCII ( Indian Standard Code for Information Interchange ). Encoding scheme for representing
various system of India. Uses 8 – bits, adopted by the Bureau of Indian Standards (BIS) Now
replaces by Unicode.
26. Which logic gate can accept only one output? (NOT)
27. NOR gate is the inverted OR gate. Prove this diagrammatically?
28. Name the gates that are known as Universal gates and why?
29.
Draw the logic circuit of the expression Y . Z + Y . Z +Y . Z + Y = 1 . Also prove this using
algebraic method

30. Match the following


Boolean Law Statement 1 Statement 2
Additive identity 0+X=X 1+X=1
Idempotent law X+X = X X.X=X
Complementary law X+ X=1 X.X=0
Absorption law X + (X . Y ) = X X.(X+Y)=X
Commutative law X + Y= Y+X X.Y= Y.X

31. Define the term Boolean variable? ( The variable which can store logical constants 0 and 1 are
called boolean variable )
32. Draw an AND gate with three inputs ?
33. Write the importance of Unicode over other coding system ? (8 – bits are not enough to represent
all characters of written languages of the world and other symbols. UNICODE is developed to
resolve this problem ).
34. EBCDIC stands for ............ (Extended Binary Coded Decimal Interchange )
35. Explain Various coding system used for representing characters in computer memory ? ( a). Sign
and Magnitude form: In this 8 – bit method, MSB is used to denote the sign . For negative integer,
sign bit is 1 and for positive sign bit is 0. The other 7 bits are used to represent magnitude of the
integer. b). 1's complement form: Here first find the binary equivalent of the absolute value of
the integer and write it in 8 bit for. If the number is negative , interchange every zero and one. If
the number is positive, write the binary as it is . c). 2's complement form: First find the 1's
complement of the number. Then add 1 to its 1's complement. )
36.
Construct a logical circuit for the boolean expression a. b + a. b. Also write the truth table.

37. Find the largest number in the series (10000)2 , (1000) 8 , (100) 10 , (10) 16

You might also like