Fundamentals of Computer Unit 3
Fundamentals of Computer Unit 3
Postulates of Boolean Algebra - Boolean Operations - Principle of Duality - Basic Laws of Boolean Algebra -
De Morgan’s Theorem – Boolean Expressions. Logic Gates and Digital Circuits: - Introduction - Basic Logic
Gates - Derived Logic Gates - Conversion of Boolean Functions - Adder Circuits – Flipflop Circuits - Application
of Flip-flops. Computer Software: - Introduction - Types of Computer Software - System Management
Programs – System Development Programs - Standard Application Programs - Unique Application Programs -
Problem-Solving - Structuring the Logic - Using the Computer.
Introduction:
• An algebra that deals with binary number system is called “Boolean Algebra”.
• It is very power in designing logic circuits used by the processor of computer system.
• The logic gates are the building blocks of all the circuit in a computer.
• Boolean algebra derives its name from the mathematician George Boole (1815-1864) who isconsidered
the “Father of symbolic logic”.
• Boolean algebra deals with truth table TRUE and FALSE.
• It is also called as “Switching Algebra”.
• A variable used in Boolean algebra or Boolean equation can have only one of two variables.The two
values are FALSE (0) and TRUE (1)
• A Sentence which can be determined to be TRUE or FALSE are called logical statements or
truth functions and the results TRUE or FALSE is called Truth values.
• The variables which can store the truth values are called logical variables or binary valuedvariables.
These can store one of the two values 1 or 0.
• The decision which results into either YES (TRUE or 1) or NO (FALSE or 0) is called Binarydecision.
Truth Table:
• A truth table is a mathematical table used in logic to computer functional values of logical
expressions.
• A truth table is a table whose columns are statements and whose rows are possible scenarios.
• Example: Consider the logical expression
Logical Statement: Meals = “Ram prefer rice and roti for the meal”
Y = A AND B (Logical Variables: Y, A, B, Logical Operator AND)
Logical Operators:
NOT Operator:
• The Not operator is a unary operator. This operator operates on single variable.
• The operation performed by Not operator is called complementation.
• The symbol we use for it is bar.
• ̅𝐗 means complementation of X
OR Operator:
• The OR operator is a binary operator. This operator operates on two variables.
• The operation performed by OR operator is called logical addition.
• The symbol we use for it is ‘+’.
• Example: X + Y can be read as X OR Y
• The Truth table and the Venn diagram for the NOT operator is:
X Y X+Y
0 0 0
0 1 1
1 0 1
1 1 1
AND Operator:
• The AND operator is a binary operator. This operator operates on two variables.
• The operation performed by AND operator is called logical multiplication.
• The symbol we use for it is ‘.’.
X Y ̅Y X+ ̅𝐘
0 0 1 1
0 1 0 0
1 0 1 1
1 1 0 1
Exercise Problems:
1. Prepare a table of combination for the following Boolean algebra expressions.
a) X
̅ Y +̅ X
Y b) XY Z̅ + ̅X ̅Y Z
2. Verify using truth table for the following Boolean algebra.
a) X + XY = X b) ̅̅ X
̅ = ̅X . ̅Y
Y
+
Boolean Postulates:
• The fundamental laws of Boolean algebra are called as the postulates of Boolean algebra.
• These postulates for Boolean algebra originate from the three basic logic functions AND, ORand NOT.
• Properties of 0 and 1:
I. If X ≠ 0 then X = 1, and If X ≠1 then X = 0
II. OR relation ( Logical Addition)
a. 0 + 0 = 0 c. 1 + 0 = 1
b. 0 + 1 = 1 d. 1 + 1 = 1
III. AND relation ( Logical Multiplication)a. 0
.0=0 c. 1 . 0 = 0
b. 0 . 1 = 0 d. 1 . 1 = 1
a. ̅0= 1 b. ̅1= 0
Principle of Duality Theorem:
• Boolean Theorem can be proved by substituting all possible values of the variable that are 0and 1.
• This technique of proving theorem is called Proof by perfect induction.
Sl No Theorem Sl No Theorem
Properties of 0 and 1 Associative Law
1 0+X=X 12 X .(Y.Z) = (X.Y).Z
2 1+X=1 13 (X+Y).Z = X+(Y.Z)
3 0.X=0 Distributive Law
4 1.X=X 14 X.(Y+Z) = X.Y + X.Z
Indempotence Law 15 X+Y.Z = (X+Y).(X+Z)
5 X+X=X Absorption Law
6 X.X=X 16 X + XY = X
Complementary Law 17 X(X+Y) = X
7 X + ̅X = 1 18 XY + X̅Y = X
8 X . ̅X = 0 19 (X+Y)(X+̅Y)= X
Involution Law 20 X+̅XY = X+Y
9 "
X=X 21 X(̅X+Y) = XY
Commutative Law
10 X+Y=Y+X
11 X.Y=Y.X
Theorem 1: 0+X=X
Theorem 2: 1+X=1
Theorem 4: 1.X=X
Indempotence Law: “This law states that when a variable is combines with itselfusing OR or AND
operator, the output is the same variable”.
Theorem 5: X+X=X
Theorem 6: X.X=X
= RHS
Complementary Law: “This law states that when a variable is And ed with itscomplement is equal
to 0 and a variable is OR ed with its complement is equal to 1”.
Theorem 7: X + ̅𝐗= 1
Theorem 8: X . ̅𝐗= 0
Involution Law: “This law states that when a variable is inverted twice is equal tothe original variable”.
Theorem 9: "
𝐗=X
Commutative Law: “This law states that the order in which two variable are Or edor AND ed make no
difference”.
Associative Law: “This law allows the removal of brackets from an expression andregrouping of the
variables”.
= (X.0).Z = (X.1).Z 0 1 1 0 1 0 0
= 0.Z = X.Z 1 0 0 0 0 0 0
=0 = XZ 1 0 1 0 0 0 0
Therefore LHS = RHS Therefore LHS = RHS 1 1 0 1 0 0 0
1 1 1 1 1 1 1
Theorem 13: X+(Y+Z) = (X+Y)+Z
Proof: If Y = 0 Proof: If Y = 1 Using Truth Table
LHS = X+(Y+Z) LHS = X+(Y+Z)
= X+(0+Z) = X+(1+Z) X Y Z X+Y Y+Z X+(Y+Z) (X+Y)+
0 0 0 0 0 0 Z
= X+Z = X+1 0
0 0 1 0 1 1
=1 1
0 1 0 1 1 1
RHS = (X+Y)+Z RHS = (X+Y)+Z 1
0 1 1 1 1 1
= (X+0)+Z = (X+1).Z 1 0 0 1 0 1 1
= X+Z = 1+Z 1 0 1 1 1 1 1
Therefore LHS = RHS =1 1 1 0 1 1 1 1
Therefore LHS = RHS 1 1 1 1 1 1 1
1
Distributive Law: “This law allows the multiplying or factoring out an expression”.
Theorem 14: X.(Y+Z) = XY + XZ
Theorem 15: (𝑋 + 𝑌) (𝑋 + 𝑍) = 𝑋 + 𝑌𝑍
LHS: (𝑋 + 𝑌) (𝑋 + 𝑍) = 𝑋𝑋 + 𝑋𝑍 + 𝑋𝑌 +𝑌𝑍
= 𝑋 + 𝑋𝑍 + 𝑋𝑌 + 𝑌𝑍
= 𝑋(1 + 𝑍) + 𝑋𝑌 + 𝑌𝑍
= 𝑋 + 𝑋𝑌 + 𝑌𝑍 Important
= 𝑋(1 + 𝑌) + 𝑌𝑍 2 Marks
= 𝑋 + 𝑌𝑍
= RHS
Absorption Law: “This law enables a reduction of complicated expression to asimpler one by absorbing
common terms”.
17) X (X+Y) = X 18) XY + X̅𝐘= X
16) X+XY = X
LHS = X (X+Y) LHS = XY + X̅Y
LHS = X + XY
= XX + XY = X(Y+̅Y)
= X (1 + Y)
= X + XY = X.1
=X
= X (1+Y) =X
= RHS
=X = RHS
The first law states that the complement of the product of the variables is equal to the sum of their individual
complements of a variable.
The truth table that shows the verification of De Morgan’s First law is given as follows:
A B A’ B’ (A.B)’ A’+B’
0 0 1 1 1 1
0 1 1 0 1 1
1 0 0 1 1 1
1 1 0 0 0 0
The last two columns show that (A.B)’ = A’+B’.
The second law states that the complement of the sum of variables is equal to the product of their individual
complements of a variable.
The following truth table shows the proof for De Morgan’s second law.
A B A’ B’ (A+B)’ A’. B’
0 0 1 1 1 1
0 1 1 0 0 0
1 0 0 1 0 0
1 1 0 0 0 0
Product Term. In Boolean algebra, the logical product of several variables on which a function
depends is considered to be a product term. In other words, the AND function is referred to as a
product term or standard product. The variables in a product term can be either in true form or
in complemented form.
Sum Term. An OR function is referred to as a sum term. The logical sum of several variables
on which a function depends is considered to be a sum term. Variables in a sum term can also
be either in true form or in complemented form.
For example, A + B + C′ is a sum term.
Sum of Products (SOP). The logical sum of two or more logical product terms is referred to as
a sum of products expression. It is basically an OR operation on AND operated variables.
Product of Sums (POS). Similarly, the logical product of two or more logical sum terms is
called a product of sums expression. It is an AND operation on OR operated variables.
Standard form. The standard form of the Boolean function is when it is expressed in sum of
the products or product of the sums fashion.
Minterm:
A Boolean function is expressed as the logical sum of all the minterms from the rows of a truth table,
for which the value of the function is 1, it is referred to as the canonical sum of product expression.
The same can be expressed in a compact form by listing the corresponding decimal-equivalent codes
of the minterms containing a function value of 1.
For example, if the canonical sum of product form of a three-variable logic function F has the
minterms A′BC, AB′C, and ABC′, this can be expressed as the sum of the decimal codes corresponding
to these minterms as below.
F (A,B,C) = (3,5,6)
= m3 + m5 + m6
= A′BC + AB′C + ABC′
The canonical sum of products form of a logic function can be obtained by using the following
procedure:
1. Check each term in the given logic function. Retain if it is a minterm, continue to
examine the next term in the same manner.
2. Examine for the variables that are missing in each product which is not a minterm.
If the missing variable in the minterm is X, multiply that minterm with (X+X′).
3. Multiply all the products and discard the redundant terms.
Example Obtain the canonical sum of product form of the following function:
F (A, B) = A + B
Solution. The given function contains two variables A and B. The variable B is missing from
the first term of the expression and the variable A is missing from the second term of the
expression. Therefore, the first term is to be multiplied by (B + B′) and the second term is to
be multiplied by (A + A′) as demonstrated below.
F (A, B) = A + B
= A.1 + B.1
= A (B + B′) + B (A + A′)
= AB + AB′ + AB + A′B
= AB + AB′ + A′B (as AB + AB = AB)
Hence the canonical sum of the product expression of the given function is
F (A, B) = AB + AB′ + A′B.
Maxterm
A sum term containing all n variables of the function in either true or complemented
form is called the max term. Each maxterm is obtained by an OR operation of the variables in
their true form or complemented form. Four different combinations are possible for a two-
variable function, such as, A′ + B′, A′ + B, A + B′, and A + B. These sum terms are called the
standard sums or maxterms. Note that, in the maxterm, a variable will possess the value 0, if
it is in true or uncomplemented form, whereas, it contains the value 1, if it is in complemented
form.
The main property of a maxterm is that it possesses the value of 0 for only one combination
of n input variables and the rest of the 2n –1 combinations have the logic value of 1. This
means, for the above three variables example, if A = 1, B = 1, C = 0 i.e., for input combination
of 110, there is only one combination A′ + B′ + C that has the value 0, the rest of the seven
combinations have the value 1.
A Boolean function is expressed as the logical product of all the maxterms from the
rows of a truth table, for which the value of the function is 0, it is referred to as the canonical
product of sum expression. The same can be expressed in a compact form by listing the
corresponding decimal equivalent codes of the maxterms containing a function value of 0.
For example, if the canonical product of sums form of a three-variable logic function F has the
maxterms A + B + C, A + B′ + C, and A′ + B + C′
F (A,B,C) = Π (0,2,5)
= M0 M2 M5
= (A + B + C) (A + B′ + C) (A′ + B + C′)
The canonical product of sums form of a logic function can be obtained by using the following
procedure.
1. Check each term in the given logic function. Retain it if it is a maxterm, continue to
examine the next term in the same manner.
2. Examine for the variables that are missing in each sum term that is not a maxterm. If
the missing variable in the maxterm is X, add that maxterm with (X.X′).
3. Expand the expression using the properties and postulates as described earlier and
discard the redundant terms.
Example Obtain the canonical product of the sum form of the following function.
F (A, B, C) = (A + B′) (B + C) (A + C′)
Solution. In the above three-variable expression, C is missing from the first term, A is missing
from the second term, and B is missing from the third term. Therefore, CC′ is to be added with
first term, AA′ is to be added with the second, and BB′ is to be added with the third term. This
is shown below.
Hence the canonical product of the sum expression for the given function is
Logic Gates
A logic gate is a simple switching circuit that determines whether an input pulse can pass
through to the output in digital circuits.
The building blocks of a digital circuit are logic gates, which execute numerous logical
operations that are required by any digital circuit. These can take two or more inputs but
only produce one output.
Types of Logic Gates
A logic gate is a digital gate that allows data to be transferred. Logic gates, use logic to
determine whether or not to pass a signal. Logic gates, on the other hand, govern the flow of
information based on a set of rules. The following types of logic gates are commonly used:
1. AND
2. OR
3. NOT
4. NOR
5. NAND
6. XOR
7. XNOR
Basic Logic Gates
AND Gate
An AND gate has a single output and two or more inputs.
1. When all of the inputs are 1, the output of this gate is 1.
2. The AND gate’s Boolean logic is Y=A.B if there are two inputs A and B.
An AND gate’s symbol and truth table are as follows:
Input Output
A B A AND B
0 0 0
0 1 0
1 0 0
1 1 1
Therefore, in And gate, the output is high when all the inputs are high.
OR Gate
Two or more inputs and one output can be used in an OR gate.
1. The logic of this gate is that if at least one of the inputs is 1, the output will be 1.
2. The OR gate’s output will be given by the following mathematical procedure if there are two
inputs A and B: Y=A+B
Input Output
A B A OR B
0 0 0
0 1 1
1 0 1
1 1 1
Symbol of OR gate
Therefore, in the OR gate, the output is high when any of the inputs is high.
NOT Gate
The NOT gate is a basic one-input, one-output gate.
1. When the input is 1, the output is 0, and vice versa. A NOT gate is sometimes called an
inverter because of its feature.
2. If there is only one input A, the output may be calculated using the Boolean equation Y=A’.
Input Output
A Not A
0 1
1 0
Symbol of NOT gate
A NOT gate, as its truth table shows, reverses the input signal.
Universal Logic Gates
NOR Gate
A NOR gate, sometimes known as a “NOT-OR” gate, consists of an OR gate followed by a
NOT gate.
1. This gate’s output is 1 only when all of its inputs are 0. Alternatively, when all of the inputs
are low, the output is high.
2. The Boolean statement for the NOR gate is Y=(A+B)’ if there are two inputs A and B.
Input Output
A B A NOR B
0 0 1
0 1 0
1 0 0
1 1 0
By comparing the truth tables, we can observe that the outputs of the NOR gate are the polar
opposite of those of an OR gate. The NOR gate is sometimes known as a universal gate since
it may be used to implement the OR, AND, and NOT gates.
NAND Gate
A NAND gate, sometimes known as a ‘NOT-AND’ gate, is essentially a Not gate followed
by an AND gate.
1. This gate’s output is 0 only if none of the inputs is 0. Alternatively, when all of the inputs
are not high and at least one is low, the output is high.
2. If there are two inputs A and B, the Boolean expression for the NAND gate is Y=(A.B)’
Input Output
A B A NAND B
0 0 1
0 1 1
1 0 1
1 1 0
By comparing their truth tables, we can observe that their outputs are the polar opposite of
an AND gate. The NAND gate is known as a universal gate because it may be used to
implement the AND, OR, and NOT gates.
Other Logic Gates
XOR Gate
The Exclusive-OR or ‘Ex-OR’ gate is a digital logic gate that accepts more than two inputs
but only outputs one value.
1. If any of the inputs is ‘High,’ the output of the XOR Gate is ‘High.’ If both inputs are ‘High,’
the output is ‘Low.’ If both inputs are ‘Low,’ the output is ‘Low.’
2. The Boolean equation for the XOR gate is Y=A’.B+A.B’ if there are two inputs A and B.
Input Output
A B A XOR B
0 0 0
0 1 1
1 0 1
1 1 0
Its outputs are based on OR gate logic, as we can see from the truth table.
XNOR Gate
The Exclusive-NOR or ‘EX-NOR’ gate is a digital logic gate that accepts more than two
inputs but only outputs one.
1. If both inputs are ‘High,’ the output of the XNOR Gate is ‘High.’ If both inputs are ‘Low,’
the output is ‘High.’ If one of the inputs is ‘Low,’ the output is ‘Low.’
2. If there are two inputs A and B, then the XNOR gate’s Boolean equation is: Y=A.B+A’B’.
Input Output
A B A XNOR B
0 0 1
0 1 0
1 0 0
1 1 1
The truth table shows that its outputs are based on NOR gate logic.
Uses of Logic Gates
1. Logic gates are utilized in a variety of technologies. These are components of chips (ICs),
which are components of computers, phones, laptops, and other electronic devices.
2. Logic gates may be combined in a variety of ways, and a million of these combinations are
necessary to make the newest gadgets, satellites, and even robots.
3. Simple logic gate combinations can also be found in burglar alarms, buzzers, switches, and
street lights. Because these gates can make a choice to start or stop based on logic, they are
often used in a variety of sectors.
4. Logic gates are also important in data transport, calculation, and data processing. Even
transistor-transistor logic and CMOS circuitry make extensive use of logic gates.
Inversion NOT
Simplification of Boolean Expression using the k-map K-map is a technique of simplifying the
Boolean expressions using graphical representation method. It simplifies the expressions by
combining the similar expressions and deleting the repeated variables. K-map expresses all the
input and the output valuesgiven in the truth table in the form of a graphical representation. shows
a truth table and its corresponding k-map.
The 0’s and 1’s written at the top of the k-map represent the values of the input variables,A
and B. The values written inside the boxes of the k-map represent the values of the output Y. For
example, the lower left corner contains the output corresponding to the inputs A = 1, B = 0.
Moreover, the decimal value corresponding to each block is also written inside the block.
The k-map shown in Fig. 9.9 can also be termed as a two-variable k-map. Depending on the
number of variables used in a Boolean expression, a k-map can have three or four variables, as
shown in Fig. 9.10.
The plotting of a Boolean expression on the k-map is the first step in simplifying the expression.
To plot a Boolean expression on a k-map, we first need to draw the k-map depending upon the
number of input variables present in the expression. Then, we need to fill the k-map with 1’s at all
those places for which a product or sum term is present in the expression.
The next step in simplifying the Boolean expression is to group the 0’s and 1’s present in the k-
map. When adjacent 1’s are grouped, SOP form of Boolean expression is obtained and when
adjacent 0’s are grouped, POS form of Boolean expression is obtained. Don’t care conditions
can also be grouped with1’s or 0’s. Don’t care conditions refer to those outputs, whose values
cannot be determined from the given inputs. The simplification of Boolean expression involves
grouping of two, four and eight adjacent 1’s and 0’s.
After the groups of 1’s and 0’s are marked in a k-map, the groups are analysed for change of
state of input variables. If a variable changes its state from 1 to 0 or vice versa then this variable is
eliminated from the term of the simplified Boolean expression.
Group of two adjacent 1’s In a k-map, two adjacent 1’s can be grouped in different ways.
(a), (b), (c) and (d) represent the various ways of grouping two adjacent 1’s.
The grouping of two horizontal 1’s The grouping of two vertical 1’s
Solution-
Then, we have-
Now,
F(A, B, C, D)
= (A’B + AB)(C’D + CD) + (A’B’ + A’B + AB + AB’)C’D + (A’B’ + AB’)(C’D’ + CD’)
= BD + C’D + B’D’
Inpu Output
t
A B Su Carry
m
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
Full Adder:
A full adder is a digital circuit that adds three binary numbers and produces the sum and carry.
The circuitryof full adder comprises of two XOR gates to produce the sum of the input values and
an AND gate to produce the carry.
• In other words, in a full adder circuit, two half adder circuits are combined to generate the
result of addition of three binary numbers. Figure 9.23 shows the circuit diagram of a full
adder.
The circuit diagram of a full adder
• Input 1, Input 2 and Input 3 are the three inputs of the full adder.
• Input 1 and Input 2 are provided to the first XOR gate, XOR1, which produces the sum
of the first two numbers. The output of the XOR1 gate is applied to another XOR gate,
XOR2 along with the third input, Input 3. The XOR2 gate produces the final sum of
three inputs.
• Similarly, Input 1 and Input 2 are provided to the first AND gate, AND1, which produces
the carry for the addition of the first two numbers. The output of the AND1 gate is
applied to another AND gate, AND2 along with the third input, Input 3. The AND2 gate
produces the final carry for the addition of three inputs. Table 9.10 shows the truth table
of a full adder circuit.
4-bit Adder
• A 4-bit adder is a digital circuit that helps the CPU in performing addition of two 4 bit
binary numbers.
• The 4-bit binary adder is implemented by using four full adder circuits, each corresponding
to one of the four bits of theoperands.
• Each full adder adds two input bits along with the previous carry and generates the sum and
the carry bits.
• The output of each of thefull adder comprises the 4-bit addition result andthe carry generated
by the 4th adder comprises the final carry of the addition operation. Figure shows the logic
circuit of the 4-bit binary adder.
Input Output
A B C Sum Carry
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
•
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
FLIP-FLOP CIRCUITS
• The flip-flop is a sequential electronic circuit that is used to store 1-bit information, i.e.,
either 0 or 1.
• A sequential electronic circuit produces the output on the basis of the present input as well
as the previous output of the circuit.
• To store information in a flip-flop, two stable states, set or reset are used along with a clock
signal. The set state represents the value 1 and the reset state represents the value 0.
• All flip-flops generate two outputs, one is the present output of the circuit and the other is
the complemented value of the present output.
The various types of flip-flops are:
• SR
• JK
• D type
• T type
SR Flip Flop
The S-R flip flop is the most common flip flop used in the digital system. In SR flip flop, when
the set input "S" is true, the output Y will be high, and Y' will be low. It is required that the wiring of
the circuit is maintained when the outputs are established. We maintain the wiring until set or reset
input goes high, or power is shutdown.
The S-R flip flop is the simplest and easiest circuit to understand.
Truth Table:
J-K Flip-flop
The JK flip flop is used to remove the drawback of the S-R flip flop, i.e., undefined states. The
JK flip flop is formed by doing modification in the SR flip flop. The S-R flip flop is improved in order
to construct the J-K flip flop. When S and R input is set to true, the SR flip flop gives an inaccurate
result. But in the case of JK flip flop, it gives the correct output.
In J-K flip flop, if both of its inputs are different, the value of J at the next clock edge is taken by
the output Y. If both of its input is low, then no change occurs, and if high at the clock edge, then from
one state to the other, the output will be toggled. The JK Flip Flop is a Set or Reset Flip flop in the
digital system.
Truth Table:
D Flip Flop
D flip flop is a widely used flip flop in digital systems. The D flip flop is mostly used in shift-
registers, counters, and input synchronization.
Truth Table:
T Flip Flop
Just like JK flip-flop, T flip flop is used. Unlike JK flip flop, in T flip flop, there is only single
input with the clock input. The T flip flop is constructed by connecting both of the inputs of JK flip
flop together as a single input.
The T flip flop is also known as Toggle flip-flop. These T flip-flops are able to find the complement
of its state.
Truth Table:
Data Storage
• A flip flop store one bit at a time in digital circuit. In order to store more than one bit flip flop
can be connected in series and parallel called registers.
• A register is simply a data storage device for a number of bits in which each flip flop store one
bit of information (0 or 1). Thus a 4 bit register consists of 4 individual flip flops, each able to
store one bit of information at a time.
Figure: shows a 4 bit register. Any number from (0000)2 to (1111)2 may be stored in it simply by
setting or resetting the appropriate flip flops. Let us suppose that flip flop one is SET(1) , Flip flop 2
is RESET(0), flip flop 3 is RESET(0) and flip flop 4 is SET(1), the binary number stored in this register
is (1001)2.
Data Transfer
• Flip flops can also be used extensively to transfer the data. For this purpose shift register is
used.
• A shift register is a register which is able to shift or transfer it content within itself without
changing the order of the bits.
• It may be designed to shift or transfer data either left or right. The data is shifted or transferred
one bit at a time, when a clock pulse is applied.
• The shift register can be used for temporary storage of data. The shift register is used for
multiplication and division where bit shifting is required. The shift register can be built using
RS, JK or D flip flops.
A four stage shift right register is shown in Figure 2. Input data is applied to store D and shifted right.
Counter
• Another major application of flip flops is a digital counter. It is used to count pulses or events
and it can be made by connecting a series of flip flops. Counter can count up to 2n. Where n is
the number of flip flops. Figure shows a simplest binary ripple counter made by flip flops.
• It consists of connections of flip flop without any logic gate. Each flip flop is triggered by the
output of its proceeding flip flop.
Frequency Division:
Flip flops can divide the frequency of periodic waveform. When a pulse wave is used to toggle an flip
flop, the output frequency becomes one half the input frequency, as shown in Figure 4
Figure: JK Flip Flop Used as A Frequency Division
The output of each flip flop is half the frequency of an input. If the input frequency is 160 KHz then
output of each flip flop would be so after first flip flop, 40 after second flip flop and 20 after third flip
flop.
Input frequency 160 KHz
Frequency of first flip flop 80 KHz
Frequency of 2nd flips flop 40 KHz
Frequency of 3rd flips flop 20 KHz
Computer Software: -
Introduction:
All computer systems consist of two major components, namely, hardware and software. The hardware
refers to the physical equipment that is necessary for performing various operations, such as reading
and processing data, storing results, and providing output to the users in a desired form. The software
refers to a set of computer programs that are required to enable the hardware to work and perform these
operations effectively. A computer program is basically a set of logical instructions, written in a
computer programming
language that tells the computer how to accomplish a task. The software is therefore an essential
interface between the hardware and the user.
System Software
System software consists of many different programs that manage and support different tasks.
Depending
upon the task performed, the system software can be classified into two major groups:
• System management programs used for managing both the hardware and software systems.
• System development programs used for developing and executing application software.
Application Software
Application software includes a variety of programs that are designed to meet the information
processing
needs of end users. They can be broadly classified into two groups:
• Standard application programs that are designed for performing common application jobs.
• Unique application programs that are developed by the users themselves to support their
specific
needs.
Operating System
Operating System (OS) is the principal component of systemsoftware and is responsible for
overall management of computer resources. It also provides an interface between the
computer and the user and helps in implementing the application programs as illustrated in
Fig. 10.5.
Major functions of an operating system are:
• Scheduling and execution of all processes.
• Allocation and management of main memory and otherstorage areas to the programs.
• Coordination and assignment of different hardware devicesto the programs.
• Creation, storage and manipulation of files required by thevarious processes.
• Determining and maintaining the order of execution of programs.
• Interpretation of commands and instructions.
• Coordination and assignment of other development and utility programs.
• Providing a friendly interface between the computer and the user.
• Ensuring security of access to computer resources.
Operating systems are usually supplied by the hardware manufacturers and are rarely developed
Hardware-OS-User Interface
Utility Programs:
In computing, the device driver is a type of software that operates or controls some specific
hardware devices linked to your system. They provide a software interface to hardware devices
allowing computer operating systems and other applications to fetch hardware functions without
knowing the exact specifications of the hardware. Some common examples of such device drivers that
connect hardware devices (printers, sound cards, network cards, hard disks, floppy disk, keyboard,
mouse, etc.) to a system easily are as follows:
Language Translators
A language translator is used to convert
the program code written in one
language to another language. The
program code provided as input tothe
language translator is known as source
code. The source code is a high-level or
an assembly language program. The
language translator converts the high-
level language program into the low-
level language program called object
code. Compiler, interpreter, and
assembler are the most common
examples of language translators. A
compiler translates a high-level program Language translators
into a low-level program and an
assembler translates an assembly
language program into a low-level program. An interpreter also produces a low-level program from a high-
level program, but the working of the interpreter is not similar to that of the compiler. An interpreter processes
the high-level program line-by-line and simultaneously, produces the low-level program. On the other hand,
a compiler compiles the high-level program in one go. The figure shows the input and the output of the
various language translators.
Linkers
Most of the high-level languages allow the developer to develop a large program containing multiple
modules. Linker arranges the object code of all the modules that have been generated by the language
translator into a single program. The execution unit of the computer system is incapable of linking all the
modules at the execution time and therefore, linker is regarded as one of the important software because of
its ability to combine all the modules into a single program. Linker assembles the various objects generated
by the compiler in such a manner that all the objects are accepted as a single program during execution.
Linker also includes the links of various objects, which are defined in the runtime libraries. In many cases,
linker inserts the symbolic address of the objects in place of their real address. Below Figure illustrates the
working of a linker.
Debuggers
Debugger is the software that is used to detect the errors and bugs present in the programs. The debugger
locates the position of the errors in the program code with the help of what is known as the Instruction Set
Simulator (ISS) technique. ISS is capable of stopping the execution of a program at the point where an
erroneous statement is encountered.
Debugger is divided into two types, namely, machine-level debugger and symbolic debugger. The
machine-level debugger debugs the object code of the program and shows all the lines where bugsare
detected. On the other hand, the symbolic debugger debugs the original code, i.e., the high-level language
code of the program. It shows the position of the bug in the original code of the program developed by the
programmer.
Working of linker
The debugger performs a number of functions other than debugging, such asinserting breakpoints in the
original code, tracking the value of specific variables, etc. In order to debug the program, a debugger helps
us to perform the following tasks:
• Step-by-step execution of a program
• Back tracking for checking the previous steps
• Stopping the execution of the program until the errors are corrected
Editors
Editor is a special program that allows the user to work with text in the computer system. It is used for the
documentation purposes and enables us to edit the information present in an existing document or a file.
The editor enables us to perform the various editing operations such as copy, cut and paste while editing the
text. On the basis of the content edited by the editors, they are divided into the following categories:
• Text editor It is used to edit plain text. An operating system always includes a text editor for updating
the configuration files.
• Digital audio editor It is used to edit the information related to the audio components of a multimedia
application. These editors are used in audio applications where editing the music and the sound signals
is necessary.
• Graphics editor It is used to edit the information related to the graphical object. These editorsare
generally used in the multimedia applications where the user is working with multiple animation
objects.
• Binary file editor It is used to edit the digital data or the binary data, i.e., data having strings of0s
and 1s.
• HTML editor It is used to edit the information included in the web pages.
• Source code editor It is used to edit the source code of a program written in a programming
language such as C, C++ and Java.
Problem solving
Problems that can be solved through a computer may range in size and complexity. Since
computers do not possess any common sense and cannot make any unplanned decisions, the
problem, whether it is simple or complex, has to be broken into a well-defined set of solution steps
for the computer to implement.
Problem solving is the process of solving a problem in a computer system by following a
sequence of steps. The major steps that we need to follow for solving a problem are:
1. Preparing hierarchy chart A hierarchy chart shows the top-down solution of a problem. In
caseof large problems, we can break them into parts representing small tasks, prepare several
algorithms and later combine them into one large algorithm.
2. Developing algorithm An algorithm is a sequence of steps written in the form of English
phrases that specify the tasks that are performed while solving a problem. It involves
identifying the variable names and types that would be used for solving the problem.
3. Drawing flowchart A flowchart is the graphical representation of the flow of control and
logic in the solution of a problem. The flowchart is a pictorial representation of an algorithm.
4. Writing Pseudocode Pseudocode is pretty much similar to algorithms. It uses generic syntax
for describing the steps that are to be performed for solving a problem. Along with the
statements written using generic syntax, pseudocode can also use English phrases for
describing an action.
Hierarchy Chart
Hierarchy chart is a solution approach that
suggests a top-down solution of a problem.
We very often come across large problems
to be solved using computers. It may be
very difficult to comprehend the solution
steps of such large problemsat one go. In
such situations, we can decompose the
problem into several parts, each representing
a small task which is easily comprehensible
and solvable. We canthen prepare solution
steps for each taskindependently and later
combine them into
one large solution algorithm. Figure 10.13
Fig. 10.13 Hierarchy chart for pay-roll problem
illustrates a hierarchy chart for computin
pay of an employee in an organisation. Since the chart graphically illustrates the structure of a program, it is
also known as a structure chart.
While developing a computer program, we may treat each subtask as a module and prepare computer code
for testing independently. This approach is popularly known as modular programming. Note that the
hierarchy chart does not provide any detail about program logic. We have to use the tools discussed below to
prepare logic for each task.
Algorithms
Algorithms help a programmer in breaking down the solution of a problem into a number of sequential steps.
Corresponding to each step a statement is written in a programming language; all these statementsare
collectively termed as a program. The following is an example of an algorithm to add two integers and display
the result:
There is a time and space complexity associated with each algorithm. Time complexity specifies the
amount of time required by an algorithm for performing the desired task. Space complexity specifies the
amount of memory space required by an algorithm for performing the desired task. When solving a complex
problem, it is possible to have more than one algorithm to provide the required solution. The algorithm that
takes less time and requires less memory space is the best one.
Flowcharts
A flowchart can be defined as the pictorial representation of a process, which describes the sequence and flow
of the control and information in a process. The flow of information is represented in a flowchart in a step-
by-step form. This technique is mainly used for developing business workflows and solving problems using
computers.
Flowchart uses different symbols for depicting different activities, which are performed at different stages
of a process. The various symbols used in a flowchart are as follows:
• Start and end It is represented by an oval
or a rounded rectangle in a flowchart. It is used to
represent the starting and the ending of a process.
Every process starts and ends at some point so a
flowchart always contains one start as well as one Fig. 10.14 Start and end symbol
end point. Figure 10.14 shows the start and the end
symbols used in a flowchart.
• Input or output It is represented by a parallelogram in a
flowchart. It is used to represent the inputs given by the user
Fig. 10.15 Input or output symbol
to the process and the outputs given by the process to the user.
Figure 10.15 shows the input or output symbol.
• Action or process It is represented by a rectangle. It
represents the actions, logics and calculations taking place in
a process. Figure 10.16 shows the action or process symbol.
• Decision or condition It is represented by a rhombus or
a diamond shape in a flowchart. It represents the condition
or the decision-making step in the flowchart. The result of
the decision is a Boolean value, which is either true or false. Fig. 10.16 Action or process symbol
Each of these values takes the flow of the program to a certain
point, which is shown with the help of arrows. Figure 10.17
shows the decision or condition symbol.
• Arrow It is represented by a directed line in a flowchart.
It represents the flow of process and the sequence of steps in
the flowchart. It guides the process about the direction and
the sequence, which is to be followed while performing the Fig. 10.17 Decision or condition symbol
various steps in the process. Figure 10.18 shows the arrow
symbol.
Pseudocodes
Analysing a detailed algorithm before developing a program
is very time consuming. Hence, there arises a need of a
specification that only focuses on the logic of the program.
Pseudocodes serve this purpose by specifying only the logic,
which is used by the programmer for developing a computer
program.
Pseudocode is not written using specific syntax of
a programming language rather it is written with a
combination of generic syntax and normal English language. Fig. 10.20 Flowchart of addition of two numbers
It helps the programmer understand the basic logic of the program after which it is the programmer’s choice
to write the final code in any programming language.
The example of a pseudocode to add two numbers and display the result is shown below:
After the pseudocode for a computer program has been written, it is used to develop the source code
for the computer program. The source code is developed using a programming language, which can be
an assembly language or a high level programming language. After the source code has been written, the
programmer detects and eliminates any errors in the program so that the program generates the desired output
after its execution.
While writing the pseudocode for a problem, it is necessary to define all the logics used in the pseudocode
for developing the program. Pseudocode of a problem should be able to describe the sequence of execution
of statements and procedures specified in the program. The sequence of the execution of instructions
determines the basic structure of a program or the logic used to solve a problem.
The basic structure of a program comprises of different sets of the statements, whose execution is
dependent on some conditions and decisions. These conditions and decision-making statements are specified
in a control structure. Depending upon the sequence of the execution of the statements, the controlstructures
are categorised into the following types:
• Sequence structure The execution of the statements in a sequence structure is done sequentially, i.e.,
all the statements are executed in the same order as they are written in the program.
• Selection structure In the selection structure, two sets of statement blocks are written in a program
along with one or more conditions. The execution of a particular block’s statements occurs only if the
conditional statement specified at the beginning of the block is true. A selection structure is
also known as branching structure.
• Repetition structure In the repetition structure, a block of two or more instructions is specified along
with a conditional statement. The execution of these instructions is repeated many times if the
conditional statement is true. This structure is also known as looping structure.
We must incorporate these program constructs into the program design, whether as a flowchart or as a
pseudocode. We can also combine the constructs, if necessary. For example, a selection structure can be a
part of a looping structure.
Sequence Structure
In a sequence structure, multiple statements are written in a simple sequence in the program. The execution
of these statements is not affected by any condition. Generally, sequence structure is used for performing
simple computations, which do not require any decision-making. Figure 10.21 shows the representation of
statements in the sequence structure.
Selection Structure
In the selection structure, the execution of a set of statements is done according to a pre-specified condition.
The selection structure is also known as decision-making structure because the decision to execute a
particular set of statements is made on the basis of the conditional statement. The selection structure is
categorised into the following types:
• If-Then In this selection structure, If and Then clauses are used to represent a condition as well as set
of statements. In the If clause, the conditional statement is written, while in the Then clause the
set of statements to be executed are specified. The execution of the statements specified in the Then
clause occurs only if the condition is true.
• If-Then-Else This selection structure is very much similar to the If-Then selection structure. The only
difference between the two is that in If-Then-Else selection structure two sets of statements are
specified. One set of statements is represented in the Then clause and another is represented in the
Else clause. If the condition given in the If clause is true, then all the statements specified in the Then
clause are executed; otherwise statements given in the Else clause are executed.
• Case Type In this selection structure, multiple sets of statements are specified. Each block of
statements is associated with a value. The selection of a particular set of statements is made on the basis
of the value of the variable given at the beginning of the selection structure.
Figushows the representation of statements in the If-Then-Else selection structure.
Repetition Structure
In the repetition structure, only one set of multiple statements is specified. The same set of statements is
executed several times on the basis of the condition specified along with the structure. The various types of
repetition structure are as follows:
• Do-while In the Do-while structure, a set of statements is given in the Do block and a condition is
given in the While block. The statements given in the Do block are executed till the given condition
is true. At each instance of execution of block statements, the condition is checked. If the condition is
true, then only the block statements are executed; otherwise the repetition structure is terminated.
• Repeat-until The Repeat-until structure is opposite to the Do-while repetition structure. In this
structure, the repetitive execution of statements given in the Repeat clause occurs only when the
condition given in the Until clause is false.
Figure shows the representation of statements in the Do-while repetition structure.
Whenever a user wants to use a computer for solving a problem, he/she has to perform various interrelated
tasks in a systematic manner. A user can not get the solution of a problem by simply providing input to the
computer without preparing the base for solving the problem. The working process of a computer is similar
to the human mind, which first analyses the complete situation of a problem, its causes and its parameters,
and then decides the way to solve the problem on the basis of available parameters. All the activities, which
have to be performed by a user in order to solve a problem using computer, are grouped into three phases:
• Understanding the problem
• Developing a program
• Executing the program
1. Understanding the problem It is the first stage of problem solving using a computer. In this
stage, two basic activities are performed by the user. These activities are as follows:
❑ Identifying parameters and constraints A user has to identify the role of different parameters
in solving the problem, i.e., the user must have the knowledge about the relation between the
various parameters and the problem itself. After identifying the problem and its parameters, the
user has to identify the associated constraints that need to be considered in order to generate an
accurate solution of the problem. The identification of parameters and constraints help in choosing
the most appropriate method to solve the problem.
❑ Collecting information After analysing the problem and choosing the solution method, a
user has to collect the information related to the identified parameters of the problem. In order
to collect the information, a user can use the documents and reports pertaining to the previous
versions of the problem. The collected information helps in designing the layout of the output or
solution of the problem.
2. Developing a program After analysing the problem, a user has to plan for developing the program,
which will provide the solution of the program after execution. A program includes multipleinstructions
having a specific syntax. For developing a program, a user has to perform the following activities:
❑ Identifying the logical structure It is the most important activity in which a user preparesthe
logical structure of the program by analysing the various tasks that need to be performed for
solving the problem. In order to prepare the logical structure of a program, a user performs the
following task:
(i) Writing algorithm to list the various steps.
(ii) Drawing flowchart to represent the flow of information.
(iii) Writing pseudocode to specify the programming specifications.
❑ Writing the computer program After preparing the logic, a user has to write the program code
in a particular programming language. The program code should be syntactically and semantically
correct in order to generate the desired result.
❑ Debugging the program After writing the complete program, a user has to apply the debugging
techniques for removing any possible errors in the program. Several programming environments
provide debugging tools that aid the users in effectively and efficiently remove the errors in a
program.
3. Executing the program After developing an error free program, it needs to be executed in orderto
view the solution of the original problem.