67% found this document useful (3 votes)
4K views

11computer Science - Boolean Logic and Insight Into Program Execution-Notes

The document provides an overview of Boolean logic and its applications to computer science and circuit design. It discusses: 1) The basic concepts of Boolean logic including binary values of true and false, logical operations like AND, OR and NOT, and how they are represented with truth tables. 2) How Boolean logic is used to design basic logic gates like the inverter, OR, and AND gates which are the building blocks of digital circuits. 3) Additional concepts covered include Boolean expressions, theorems of Boolean algebra, and logic gate minimization through algebraic techniques. 4) The document concludes with briefly mentioning additional logic gates like NOR, NAND, XOR and XNOR that are derived from the basic

Uploaded by

Gurtegbir Singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
67% found this document useful (3 votes)
4K views

11computer Science - Boolean Logic and Insight Into Program Execution-Notes

The document provides an overview of Boolean logic and its applications to computer science and circuit design. It discusses: 1) The basic concepts of Boolean logic including binary values of true and false, logical operations like AND, OR and NOT, and how they are represented with truth tables. 2) How Boolean logic is used to design basic logic gates like the inverter, OR, and AND gates which are the building blocks of digital circuits. 3) Additional concepts covered include Boolean expressions, theorems of Boolean algebra, and logic gate minimization through algebraic techniques. 4) The document concludes with briefly mentioning additional logic gates like NOR, NAND, XOR and XNOR that are derived from the basic

Uploaded by

Gurtegbir Singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

CLASS-XI

COMPUTER SCIENCE
BOOLEAN LOGIC
AND
INSIGHT INTO PROGRAM EXECUTION
NOTES
BOOLEAN ALGEBRA

Introduction

– Boolean Logic, also known as Boolean algebra was developed by


mathematician “George Boole”.
– Later, Boolean logic helped in solving many big problems.
– These logics also helped in developing circuits.
– Complete logic is based on Yes or No which is also represented as
True(T) or False(F).
– Computer system transmits its signals on high voltage or low voltage
which can be denoted by true or false and with which we can develop its
circuit.
– In this chapter we will learn these logics.

Binary Values (Quantities)


– In our daily life, we need to take logical decisions where answers
come in either Yes (T) or No (F). For ex-
• Should I have tea?
• Should I see this movie?
• Sun rises in East? etc
– The decisions which results in Yes or No only are known as binary
decisions.
– Values T and F are known as truth values.
– Boolean variables can only be either T or F.
– Indira Gandhi was the only lady Prime Minister of India (it results in
true -T). Therefore, it is a logic statement.
What do you want to say? (it cannot be result in T or F). Therefore, it is not
a logic statement.
Logical Operations
– These are of three types -
• AND
• OR
• NOT
– These are used to develop compound statement.
– for ex -
• He prefers coffee not tea.
• He plays guitar and sitar.
• I watch TV on Sunday or I go for a movie.
– These are also used to join logical variables.
For ex-

X NOT Y OR Z
Y AND Z OR X

Logical Operations
– Before proceeding for Operations, we will get to know some features of
logic statements. For ex -
Statement– 1: I want to have tea
Statement – 2: Tea is ready.
now, develop a table with all its aspects.

(X) I want to have tea. T T F F


(Y) Tea is ready. T F T F

(R)(result) I have drink tea. T F F F

The Truth Table will be like this


– Truth Table is a table which contains all possible truth values of
logical values along with all possible results.
– When all the results of a Truth Table are true (1) this condition is known
as TAUTOLOGY and if all results are false (0) then this condition is
known as FALLACY.

X Y R
1 1 1
1 0 0
0 1 0
0 0 0
Logical Operators (NOT)
NOT operator is represented by applying ( ‘ ) or ( ¯ ) on an expression. For ex-
X’ or X. This is a unary operator also known as complementation operator.
- 0’ = 1 and 1’ = 0
- Truth table and Venn Diagram for NOT operator is as under-

X X’

0 1

1 0

Logical Operators (AND)


– AND operator is used by applying (.) between two variables. like X.Y
– It shows a very important operation of Boolean algebra which is
known as logical multiplication.
– X.Y is to be read as X AND Y.
– Rules of AND operation are-
0.0=0
0.1=0
1.0=0
1.1=1
– AND operator’s truth table is defined as-

X Y X.Y
0 0 0
0 1 0
1 0 0
1 1 1
Logical Operators (OR)

– OR operator is used by applying (+) between two variables. like X+Y


– It shows a very important operation of Boolean algebra which is
known as logical addition.
– X+Y is to be read as X OR Y.
– Rules of OR operation are-
0+0=0
0+1=1
1+0=1
1+1=1
– AND operator’s truth table is shown below:

X Y X+Y
0 0 0
0 1 1
1 0 1
1 1 1

Evaluation of Boolean Expression using Truth Table


– To develop Boolean Expression, logical variables are used
with logical operators. Truth table is used for its evaluation.
For ex- X + (Y.X)’ + Z’ is a boolean expression and its truth
table should be as follows-
X Y Z Y.Z (Y.Z)’ Z’ X+(Y.Z X+(Y.Z)’+
)’ Z’
0 0 0 0 1 1 1 1
0 0 1 0 1 0 1 1
0 1 0 0 1 1 1 1
0 1 1 1 0 0 0 0
1 0 0 0 1 1 1 1
1 0 1 0 1 0 1 1
1 1 0 0 1 1 1 1
1 1 1 1 0 0 1 1

Basic Logic Gates :

– When Shannon used Boolean logic in switching circuit of telephone then


Engineers realized that Boolean algebra can also be used in computer
electronics. In computers, logic gates are used to complete Boolean
operations.
– A Gate is a basic Electronic Circuit used to develop an output signal by
passing one or more input signal(s).
– A Gate is a kind of two-state digital circuit because its input or output
are either low voltage (i.e. 0) or high voltage (i.e.1).
– Gates are also known as logic gates because they can coordinate with
Boolean logic.
– Logic gates are of three types--
1. Inverter (NOT Gate)
2. OR Gate
3. AND Gate

Inverter (NOT Gate)

– NOT gate takes one input and produces one output.


– Its output is exactly opposite to its input.
– It is called NOT gate because its output is not similar to its input.
– Its output is also called as complement(opposite) of input.
– Truth table and diagram of Not gate are as under-

X X’
Low High
High Low

X X’
0 1
1 0
OR Gate

– OR gate takes two or more inputs and produces one output.


– Its output is logical sum of passed inputs.
-It produces high voltage output on any one high voltage input. It produces low
voltage output only when all the inputs are of low voltage.
OR Gate Truth table and diagram are as:

X Y X+Y
Low Low Low
Low High High
High Low High
High High High

X Y X+Y
0 0 0
0 1 1
1 0 1
1 1 1
AND Gate

– AND gate takes two or more inputs and produces one output.
– Its output is logical multiplication of passed inputs.
– It produces low voltage output on any of the input signal as low voltage
input. It produces high voltage output only when all the inputs are of
high voltage.
– AND Gate Truth table and diagram are as under-

X Y X .Y
Low Low Low
Low High Low
High Low Low
High High High

X Y X.Y
0 0 0
0 1 0
1 0 0
1 1 1
Boolean logic Basic Postulates
– Boolean algebra is a kind of mathematical system because of which
it is based on some fundamental laws which are known as basic
postulates. Which are as follows- -
I. If X ≠ 0 then X = 1 and if X ≠ 1 then X = 0
II. OR Relations (logical addition)
 0+0=0
 0+1=1
 1+0=1
 1+1=1
III. AND Relations (logical multiplication)
 0.0=0
 0.1=0
 1.0=0
 1.1=1
IV. Complementary Rules:
 0’ = 1
 1’ = 0

Main Theorems of Boolean Algebra


1. Properties of 0 and 1
0+X=X
0.X=0
1+X=1
1.X=X
2. Indempotence Law
X+X=X
X.X=X
3. Involution
(X)’’ = X
4. Complementarity Law
X+X’=1
X.X’=0
5. Commutative Law
X+Y=Y+X
X.Y=Y.X
6. Associative Law
X+(Y+Z) = (X+Y)+Z
X(YZ) = (XY)Z
7. Distributive Law
X(Y+Z) = XY+XZ
X+YZ=(X+Y)(X+Z)
8. Absorption Law
X+XY = X
X(X+Y) = X
9. Demorgan’s Theorem
(X+Y)’=X’.Y’
(X.Y)’ = X’+Y’

Minimization of Boolean Expression algebraically

• Minimize the expression- AB’CD’ + AB’CD +ABCD’ + ABCD


Solution:
AB’CD’ + AB’CD +ABCD’ + ABCD
= AB’C(D’+D)+ABC(D’+D)
=AB’C + ABC
= AC (B’+B) = AC.1 = AC

Other Logic Gates


– There are some derived gates also besides AND, OR, NOT Gates. Like-
NOR, NAND, XOR, XNOR Gates.
NOR Gate:
There is two or more input signals and one output signal in NOR gate.if all
input signals are 0 (low) then output signal will be 1 (high).

X Y F
0 0 1
0 1 0
1 0 0
1 1 0

NAND Gate
There is two or more input signals and one output signal in NAND gate.if all
input signals are 1 (high) then output signal will be 0 (low). It is also known as
universal gate because fundamental gates can be retrieved with its help
X Y F
0 0 1
0 1 1
1 0 1
1 1 0

XOR Gate

XOR Gate produces 1 (high) when inputs are not at equal logic level. It is also
known as universal gate because fundamental gates can be retrieved with its
help.
No of X Y F
1’s
Even 0 0 0
Odd 0 1 1
Odd 1 0 1
Even 1 1 0
XNOR Gate
XNOR Gate produces 1 (high) when the inputs are identical (both 1’s or
both 0’s).

No of X Y F
1’s
Even 0 0 1
Odd 0 1 0
Odd 1 0 0
Even 1 1 1

INSIGHT INTO PROGRAM EXECUTION:

Introduction
–As we know that computer works on machine level language which is not
understandable to a programmer, similarly programmer works with a language
which is not understandable by a computer system. When a programmer writes
a program in any high-level language it is called source code.
–Programmer uses a specific language to write a program like – C, C++, Java
etc. These languages are not directly understandable by computer system.
–Therefore, it is required to convert the instructions written in programmer’s
language into machine level language.
–In this chapter, we will have a look of internal processing of a program code,
how a program reaches to execution state and what are the contributions of an
operating system in all these processes.

Basic Flow of Compilation


– Program written in a language is known as source code.
– Source code is to be written as per the rules of a programming language.
– This souce code is then converted to machine level language, known as
binary code, in order to understand by a computer.
– We can say that a programmer develops a source code which is later
converted in to binary code so that it can be executed by computer.
Translator
– A special software is needed to convert a
Source Codeinto binary code which are as under-
• Compiler
• Interpreter
– Both these software converts source code into binary code but their way
of working is different.
– Compiler works in exactly opposite manner from interpreter.

Compilation
Compiler takes source code and, in few stages, generates low- level-code.
Compilation process stages are-
1. Processing
2. Compilation
I. Analysis [ front end phase]
II. Synthesis [ back end phase]
3. Assembly
4. Linking
5. Loader

1. Processing
This stage removes code other than source code like comments and adds the
code which is necessary for the execution of a program.

2. Compilation
Compilation phase has two sub stages-
1. Analysis [ front end phase]
I. Synthesis [ back end phase]
(i) Analysis Phase: Analysis phase develops a symbol table by all the tokens
of source code.
(ii) Synthesis Phase: This phase creates a syntax tree after parsing the source
code. A syntax tree is a syntactic tree of source code.
For ex- syntax tree of 4 * 5 + 9 will be like as -

3. Assembly Phase
This phase develops object code with the help of instructions received from
assembly level, an object code is a kind of machine code.

4. Linking
This code generated from this phase is actually binary code but still computer is
not able to execute the code because the important libraries required for
execution are still not linked with the code. This work is carried out by linker.
In this phase, operating system resolves all memory references and develops
executable (.exe file) file.

5. Loader
– Loader is a part of compiler which loads an executable file in memory.
– Now computer can run this executable file without the help of any
additional software.

THE INTERPRETATION PHASE

– Working of an interpreter is like Compiler. It also converts source code to


machine understandable code but it is different from compiler in some
definite manner.
– It converts a program line by line by adding required libraries.
– Meaning, before the conversion of second line, first line gets completely
executed.
– Interpreter follows same manner of conversion and execution for the
whole program.
Aspects Compiler Interpreter

Input It takes the whole program for It takes one line as input.
input.
Output It develops a middle object code It does not create middle object
of the program. code.
Memory This process requires much This process does not require much
memory. memory.
Errors It shows all errors together with It continues by showing error from
line number. one line at a time.
Always After sucessful compilation of a For every run of the prgram
Required program, compiler is not further interpreter is needed even after
needed. successful interpretation.
Workload It decreases workload because It’s continues requirement increases
compiler is not needed again workload.
and again for a program.

ROLE OF OPERATING SYSTEM IN PROGRAM RUNNING


– As we know that execution of an .exe file is free from any requirement
for a computer system.
– This executable file executes with the help of operating system.
– Now a days, importance and complexity of operating system has been
increased much because of multi- user and multi-processing concepts.
– Operating system works an as interface between a user and hardware.
– Also, operating system provides platform to a program to run.

OS as a Resource Manager
– A program, in its static state is known as a program and in running state it
is known as process.

– When many programs execute at the same time, OS improves or


enhance the capacity or capability of system by managing resources.
Which is to be measured in the terms of throughput.

– Throughput= Number of jobs done/ Time taken

– For Multiple Processing, OS provides following function: -

• Process Management
• Process Scheduling
• Memory Management
• I/O Management

You might also like