chapter -11 database concepts fore view points of …€¦ · 18 points of focus database: a...

75
16 CHAPTER -11 DATABASE CONCEPTS FORE VIEW POINTS OF FOCUS SOLVED PROBLEMS POINTS TO REMEMBER

Upload: others

Post on 17-May-2020

26 views

Category:

Documents


0 download

TRANSCRIPT

16

CHAPTER -11

DATABASE CONCEPTS

FORE VIEW

POINTS OF FOCUS

SOLVED PROBLEMS

POINTS TO REMEMBER

17

FORE VIEW

1. Database Concepts

.Relational data model

It represents data and relationships among data by a collection of tables known as relations, each of

which has a number of columns with unique names.

1.1.1. Concept of domain

Tuple: The row of a table (Relation).

Relation: A table with rows and columns

Keys-Primary key : A Primary Key is a set of one or more attributes that

can uniquely identify tuples within the relation.

Alternate key: A candidate key that is not the Primary key is called

an Alternate Key.

Candidate key: All attribute combinations inside a relation that can

serve as Primary key are Candidate Keys as they are

candidates for the Primary key position.

.Relational Algebra

1.2.1. Selection : The select operation selects tuples(horizontal subset) from a

relation

1.2.2. Projection : The project operation yields a “vertical” subset of a given

relation

1.2.3. Union : The union operation is a binary operation that requires

two relations as its operands

1.2.4. Cartesian Product: The Cartesian product is a binary operation and is

denoted by a cross(X).

18

POINTS OF FOCUS

Database: A database is a collection of correlated data stored together.

DBMS: Data base management system. It is basically a computer based record keeping system to

manage the database.

Domain: It is the distinguished part of an abstract or physical space where something exists, is

performed, or valid.

Data domain refers to all the unique values which a data element may contain.

For example, a database table that has information about people, with one record per person, might

have a "gender" column. This gender column might be declared as a string data type, and allowed to

have one of two known code values: "M" for male, "F" for female and NULL for records where

gender is unknown or not applicable (or arguably "U" for unknown as a sentinel value). The data

domain for the gender column is: "M", "F".

Types of data model:

1. Relational data model

2. Network data model

3. Hierarchical data model

Relational data model: It represents data and relationships among data by a collection of tables

known as relations, each of which has a number of columns with unique names.

Relation: A table with rows and columns.

Tuple: The row of a table (Relation).

Attributes: The column of a table (Relation).

Degree: The number of attributes in a relation.

Cardinality: The number of tuples (rows) in a relation.

View: A view is a (Virtual) table that does not really exist in its own right but is instead derived from

one or more existing base tables.

Primary Key: A Primary Key is a set of one or more attributes that can uniquely identify tuples

within the relation.

Candidate Key: All attribute combinations inside a relation that can serve as Primary key are

Candidate Keys as they are candidates for the Primary key position.

Alternate Key: A candidate key that is not the Primary key is called an Alternate Key.

Foreign Key: A non-key attribute, whose values are derived from the primary key of some other

table, is known as Foreign-key in its current table.

Relational algebra:

19

It is a new collection of operations on relations. Each operation takes one or more relations

as its operand and produces another relation as its result. The operations defined in relational algebra

include: select, project, Cartesian product, union, set difference, set intersection, natural join,

division etc.

The Select operation:

The select operation selects tuples(horizontal subset) from a relation that satisfy a given predicate.

The selection is denoted by lowercase Greek letter sigma σ.

The project operation:

The project operation yields a “vertical” subset of a given relation. That is, the projection lets you

select the specified attributes in a specified order. It is denoted by Greek letter pi Π.

The Cartesian product operation:

The Cartesian product is a binary operation and is denoted by a cross(X).The Cartesian product of

two relations A and B is written as AxB. The Cartesian product yields a new relation which has a

degree (no: of attributes) equal to sum of the degrees of 2 relations operated upon. It yields a relation

with all possible combinations of the tuples of the two relations operated upon.

The Union operation:

The union operation is a binary operation that requires two relations as its operands. It produces a

third relation that contains tuples from both the operand relation. Union operation is denoted by U.

The set difference operation:

The set difference operation is denoted by –(minus)allows us to find the tuples that are in one

relation but not in another. The expression A-B results in a relation containing those tuples in A but

not in B.

The set intersection operation:

The set intersection operation finds tuples that are common to the two operand relations.The set

intersection operation is denoted by ∩

20

SOLVED PROBLEMS

1 mark questions

1) Define the following terms

Database: A Database is a collection of interrelated data stored together.

DBMS: Database Management System. It is basically a computer based record keeping system to

manage the database.

Relation : A Table with rows and columns

Tuple : The row of a Table (Relation)

Attributes : The column of Table (Relation)

Degree : The number of attributes in a relation.

Cardinality: The number of tuples (rows) in a relation.

Relational Data Model: It represents data and relationships among data by a collection of tables

known as relations, each of which has a number of columns with unique names.

View : A view is a (Virtual) table that does not really exist in its own right but is instead derived

from one or more existing base tables.

Primary Key: A Primary Key is a set of one or more attributes that can uniquely identify tuples

within the relation

Candidate Key: All attribute combinations inside a relation that can serve as Primary key are

Candidate Keys as they are candidates for the Primary key position.

Alternate Key: A candidate key that is not the Primary key is called an Alternate Key.

Foreign Key: A non-key attribute, whose values are derived from the primary key of some other

table, is known as Foreign-key in its current table.

Data Redundancy: Duplication of data is known as data redundancy.

2 marks questions

1) What are the advantages of database?

Ans)PURPOSE OF DATABASE:

1) Database reduce the data redundancy.

2) Databases can control data inconsistency.

3) Databases facilitate sharing of data.

4) Database enforce standards.

5) Databases can ensure data Security.

6) Integrity can be maintained through databases.

2) What is database abstraction?

Ans) Database abstraction means that the DBMS does not disclose all the details of data, rather it

hides certain details how the data is stored and maintained.

3) What is data independence?

21

The ability to modify a scheme definition in one level without affecting a scheme definition in the

next higher level is called data independence.

5 marks questions

1) How many levels of Data Abstraction are there in a Database System and explain them briefly.

Ans) Various levels of Data Abstraction in a Database System

Internal Level (Physical Level)

This level Describes how the data is actually stored on the storage medium. At this level complex

low-level data structures are described in detail.

Conceptual Level

This level describes What data are actually stored in the database. It also describes the relationships

existing among data. At this level, the database is described logically in terms of simple data-

structures.

External Level (View Level)

This level is concerned with the way the data is viewed by the individual users. Only a part of the

database relevant to the user(s) is provided to them through this level.

2) What are the various types of data independence?

Ans) There are two levels of Data Independence

Physical Data Independence : It refers to the ability to modify the scheme followed at the Physical

level without affecting the scheme followed at the Conceptual level.

Logical Data Independence : It refers to the ability to modify the scheme followed at the Conceptual

level without affecting the scheme followed at the View level.

3) What are the various data models available for database system?

Ans) A Data Model is a collection of conceptual tools for describing data, data relationships, data

semantics etc.

Relational Data Model:

It represents data and relationships among data by a collection of tables known as relations, each of

which has a number of columns with unique names.

Network Data Model

The Network Model represents data by collection of Records and relationships among data are

represented by links which can be viewed as pointers.

Hierarchical Data Model

The Hierarchical Data Model is similar to the network model in the sense that data and relationships

among data are represented by records and links respectively. It differs from the Network model, in

that the records are organized as collection of TREES rather than arbitrary graphs.

22

Points to remember

A collection of data is referred to as database and a DBMS is a computer based record

keeping system.

Database systems help reduce data redundancy, data inconsistency and facilitate sharing of

data standardization of data and data security.

There are 3 models available in data management-relational, network and hierarchical.

A relational data model organizes the data into tables known as relations.

A view is a virtual table derived from one or more underlying base class.

The relational algebra is a collection of operations on relations. The various operations of

relational algebra are select, project, Cartesian product.

23

CHAPTER 12

STRUCTURED QUERY LANGUAGE

FORE VIEW

POINTS OF FOCUS

SOLVED PROBLEMS

POINTS TO REMEMBER

24

FOREVIEW

1. General Concepts

1.1. Aadvantages of SQL

D D L : DDL provides commands for defining relation schemas,

deleting relations, creating indexes and modifying relation .

D M L:

DML includes data manipulation queries ie, it includes

language based on both the relational algebra and the tuple

relational calculus. It includes commands to insert ,delete and

modify tuples in the database.

1.2. Data Ttypes

1.2.1 Number

1.2.2 Character

1.2.3 Date

1.3. SQL Commands

1.4. SQL Functions

25

POINTS OF FOCUS

SQL :- SQL stands for "Structured Query Language" which is the standard language used to

interact with databases. It helps us to create and operate on relational databases which are sets of

related information stored in tables.

This is originally called as “sequel” and changed in to “SQL”

Mainly SQL can be divided into DDL and DML(Data Definition language and Data Manipulation

Language)

ADVANTAGES OF SQL

1. Embedded Data Manipulation Language:-This is used for general - purpose programming

languages like Pascal, C,Cobol etc.

2. View Definition Language:- The DDL also includes commands for defining views.

3. Authorization:-The SQL DDL Includes commands for defining access rights to relations and

views.

4. Integrity:-The SQL Provides forms of integrity checking.

5. Transaction Control Statements:-SQL Includes commands for specifying the beginning and

ending of the transactions.

DDL and DML

DDL(Data Definition Language) :- DDL provides commands for defining relation schemas,

deleting relations, creating indexes and modifying relation schema.

Eg: for DDL Commands :- Create,Drop,Alter commands

DML (Data Manipulation Language):- DML includes data manipulation queries ie, it includes

language based on both the relational algebra and the tuple relational calculus. It includes commands

to insert ,delete and modify tuples in the database.

Data manipulation Language is a language that enables users to access or manipulate data as

organized by the appropriate data model.

Ie, the retreivel of information stored in database

the insertion of new information in to the database

the deletion of information from the database

the modification of data stored in the database

Eg: for DML commands Select,Insert,Update etc

DATATYPES

In SQL each field is distinguished with the help of data type that indicates the type of value the

field will contain.

26

Data type Description

Text Char(size) or

Character

Values of this type should be given in single

quotes having max string length size bytes

Varchar(size) Variable Character having max string length size

bytes

Varchar2(size) Variable Character having max string length size

bytes

Integer Number(p,s)or

Dec

Number having precision p and scale s

Precision can range from 1 to 38 and scale can

range form -84 to 127

Int or

integer(size)

It represents a number without decimal point

Float (size) It represents a floating point number in base 10

exp notation

Real Same as float but no size argument is used

Date Date Formats:-yyyy-mm-dd,

yyyy-mm-dd,

dd-mm-yyyy

mm/dd/yyyy

Time Time Formats:-hh-mm-ss

hh.mm.ss

hh.mm.AM/PM

SQL Commands

1.CREATE TABLE COMMAND

SYNTAX:- Create table <tablename>(<column name> <datatype>(<size>),

<column name> <data type>(size),….);

When we are creating a table its column should be named, data types and sizes should be supplied

for each column .Each table must have at least one column

Eg:- syntax for creating student table with 4 columnns

Sql> Create table student (sno integer,sname char(20),sex char(1),addr char(2));

GIVING CONSTRAINTS TO TABLE

A Constraint is a condition or check applicable on a field or set of fields

There are 2 types of constraints

1. Column Level constraints – Applied on a single column

2. Table level constraints- Applied on multiple columns

27

Types of Constraints:

1. Unique Constraint :-This ensures that no rows have the same value in the specified

column(s)

Syntax:

Sql> Create table student (sno integer unique,sname char(20),sex char(1),addr

char(2));

Unique constraint applied on sno of student table ensures that no rows have the same sno

value

2. Primary key Constraint:-This declares a column as the primary key of the table This is

similar to unique constraint except that one column (or one group of columns)can be applied

in this constraint .The primary key cannot allow NULL values but Unique key allows for

the first time (allows only once)

Syntax:- Create table student (sno integer primary key,sname char(20),sex

char(1),addr char(2));

Here all the values of sno will be different for all the tuples in the student relation.

Primary key uniquely identifies a tuple of a relation

3. Default constraint:-A default value can be specified for a column using the default clause

.when a user does not enter a value for the column (having default value)automatically the

defined default value is inserted in the field

Syntax:- Create table student(sno integer primary key, sname char(20),sex char(1),addr

char(2) default=’A’);

If no value is provided for addr the default value ‘A’ will be entered

4. Check constraint:-This constraint limits values that can be inserted into a column of a table

Syntax:- Create table student(sno integer primary key, sname char(20),sex char(1),addr

char(2) default=’A’,mark decimal check(mark>80));

This statement ensures that the value inserted for mark must be greater than 80

1.use of ‘IN’

desc char(20) check (desc in(‘nut’,’bolt’,’screw’))

2.use of ‘BETWEEN’

price decimal check(price BETWEEN 253.00 and 770.00)

3.use of ‘LIKE’

ordate char(10) Not null Check(ordate Like ’--/--/----‘)

5. Not null:-This constraint ensures column should not be NULL

Syntax:Create table student (sno integer Not null unique, sname char(20),sex

char(1),addr char(2));

Multiple constraints can be given by putting space in between them comma should

be given at the end of the constraint

28

Table constraint

When a constraint to be applied on a group of columns of a table we use tale constraint

Eg:- Create table student(sno integer , sname char(20),sex char(1),addr char(2) default=’A’,

primary key (sno,sname));

2. SELECT COMMAND

A select command can be used to retrieve a subset of rows or columns from one or more tables

Syntax:-SELECT <columnname>[,<columnname>,…] from <tablename>;

Eg:-select sno , sname from student;

This query displays sno and sname column of student table

To display whole table

Select * from <tablename>

Eg:-select * from student;

Elimination of redundant data with DISTINCT keyword

Select DISTINCT <columnname> from <tablename>

Eg:-Select Distinct city from Suppliers;

ALL keyword

Select ALL <columnname> from <tablename>

Eg:-select all city from suppliers;

If we give ‘ALL’ keyword it will retain multiple rows in the output.

Restricting rows with “WHERE ‘ Clause

The where clause in the select statement specifies the criteria for selection of rows to be returned

ie, we can give condition using where clause

Syntax:- select <columnname> from<tablename> WHERE condition;

Eg:-Select sno ,sname from student where mark>75;

Use of relational operators in where clause

1. Select * from suppliers where city <> ‘Delhi’;

This query will display details of the table where city not equal to Delhi

2. Select sno ,sname from student where (mark=75 or mark=89);

This query will display student details having mark 75 or 89 from table student

3. Select sno, sname from student where (grade=’E1’and mark>85);

This query will display the details of employee having grade E1 and with gross >2000

4. Condition based on a range

select sno,sname from student where mark between 75 and 100;

29

This query will display the details of students having marks between 75 and 100

5. Condition based on a list

select * from suppliers where city not in(‘Delhi’,Mumbai’,’Chennai’);

This query will display details of suppliers whose are not in Delhi,Chennai and

Mumbai

select * from suppliers where city in (‘Calcutta’, ‘Hyderabad’);

This query will display the details of suppliers whose are in Calcutta and Hyderabad

6. Condition based on pattern matches

1. select sno,sname from student where sname like ‘A%’;

This displays the details of student whose name starts with A

2. Select sno,sname from student where sname like ‘_A%’;

This displays the details of employee whose name second letter is A

‘_’ replaces one character while ‘ %’ replaces one or more characters

7. Searching for Null

Null value column can be searched for in a table using IS NULL in the where clause

Select Ecode ,ename from EMP where deptno is NULL

8.ORDER BY clause

we can sort the results of the query in a specific order using ORDER By clause

To arrange the name of the students in ascending order

Select * from student ORDER BY sname;

To arrange the name of the students in ascending order

Select * from student ORDER BY sname desc;

Order by can be used in multiple fields

Select * from student ORDER BY sno desc, sname asc ;

9.Performing simple calculations

select 4*3 from dual;

dual is a dummy table used for calculations

10. to display today’s date

Select sysdate from dual;

Aggregate functions

Avg()- to compute average value

Select avg(gross) from EMP;

30

Min()- to compute minmum value

Select min(gross) from EMP;

Max()- to compute maximum value

Select max(gross) from EMP

Sum()- to compute total value

Select sum(gross) from EMP

Count()-to count number of employees in EMP table

Select count(*) from EMP;

Count(distinct)-to count distinct number

Select count(distinct city) from EMP;

GROUP BY AND HAVING CLAUSE

The Group by clause is used in select statements to divide table into groups .Grouping can be done

by a column name or with aggregate functions in which the aggregate produces a value for each

group

Select job,count(*) ,sum(comm) from emp group by job;

This calculates the number of employees in each grade and average gross of each grade of employees

.

To introduce condition on group by we use having clause for eg:-

Select job,count(*) ,sum(comm) from emp group by job having grade=’E4’;

This calculates the number of employees in each grade and average gross of each grade of employees

whose grade =E4 .

Putting text in the output

Select salesman_name,comm.*100,’%’ from salesman;

In this query we are inserting the symbol ’%’ after comm. By putting in single inverted comma

3.CREATING TABLE FROM EXISTING ONE

syntax:- Create table <tablename> as (select command);

eg:- create table EMP1 as(Select Ecode ,ename from EMP where deptno is NULL);

4.INSERT COMMAND

The rows are added to the table using insert command

Syntax:-Insert into <tablename>[<columnlist>] values (<value>,<value>,…);

Eg:- insert into EMP Values( 1,’abc’.’f’);

31

If we are not specifying columnlist we must give values to all columns of the table if we are

specifying the column list then we should give only values to those columns for

eg:- Insert into EMP (ecode,ename)values(1,’abc’);

5.DELETE COMMAND

This is used to delete a row from the table

Syntax:-Delete from<tablename> where[<condition>];

Eg:-delete from EMP where ename=’abc’;

6.UPDATE COMMAND

we use update command if need to change the values of some or all existing rows.

Syntax:-update <tablename> set <columnname>=value where condition;

Eg:-update EMP set ename=’CDE’ where ecode=123;

We can use expressions in update command for eg:-

Update EMP set gross=gross+900;

We can also use Null values in update command for eg

Update EMP set grade =Null where grade=’E1’;

7.CREATING VIEWS

View is a virtual table with no data and need no space for storage. we can use view as a window to

view the details of a table.

Syntax for creating views:-

Create VIEW <viewname> as select statement;

Eg:-Create VIEW taxpayee as select * from EMP where gross>8000;

Views contain columns having calculated values like

Create VIEW taxpayee (ecode,ename,tax) as select ecode,ename, gross from EMP where

gross>8000;

To delete view we use drop view command

For eg:- DROP VIEW <viewname>;

Drop view taxpayee;

Select statement used in view should not contain ORDER BY,INTO

Some built-in functions:-

1. lower() - to convert into lower case

eg:- select lower(‘HELLO’) from dual;

2.Upper() - to convert in to upper case

eg:- select upper(‘hello’) from dual;

3.replicate() - to replicate the character given

32

eg:- select replicate(‘&’,4) from dual; so it will display &&&&

4.getdate() - returns the current date

5.Substr() -extracts no:of characters from a string

eg:- select substr(‘pointer’,3,2) from dual;

this will return - in

8.ALTER TABLE COMMAND

Alter table command is used to change the definitions of existing tables like adding columns,

deleting columns changing size of column etc

To add new column:-

Syntax:- ALTER TABLE <tablename> ADD <columnname>datatype<size>;

Eg:- ALTER TABLE student add mark number(1);

To modify the existing column:-

Syntax:- ALTER TABLE <tablename> modify <columnname>newdatatype<newsize>;

Eg:- Alter table student modify sno varchar2(5);

9. DROP TABLE COMMAND

Drop table command is used to delete a table structure. A table with no rows can be deleted . to

delete rows we can use delete command

Delete from <tablename> where condition;

Delete from student;

After deleting all rows we can delete the table structure using DROP Command

Syntax:- DROP TABLE <tablename>;

Drop table student;

SHORT ANSWER QUESTIONS (2 marks)

1. What do you understand by Primary Key and Candidate keys?

Ans. A Primary key is a set of one or more attributes that can uniquely identify the tuples

within the relation. Candidate keys are the attributes that can serve as a primary key.

2. Differentiate between Data Definition Language and Data Manipulation Language.

Ans. The SQL DDL provides commands for defining relation schemes, deleting relations,

creating indexes. Eg. CREATE, DROP, ALTER

The SQL DML commands are used to insert, delete, and modify tuples in the database. Eg.

INSERT, UPDATE, DELETE

33

3. Differentiate between SQL commands: DROP TABLE and DROP VIEW.

Ans. The DROP TABLE command deletes a table, whereas the DROP VIEW deletes view. The

DROP TABLE will work on empty table only, whereas in the DROP VIEW deletion of rows is

not necessary.

4. What are constraints? What are two types of constraint?

Ans. A constraint is a condition or check applicable on a field or set of fields. The two basic

types of constraints are column constraints and table constraints. The difference between the two

is that column constraints apply only to individual columns, whereas table constraints apply to

groups of one or more columns.

5. Compare DISTINCT and ALL Keywords when used with SELECT command.

Ans. DISTINCT Keyword in SELECT statement will not include duplicate rows but ALL

keyword include all the duplicate rows.

6. What is the condition of dropping table?

Ans. Drop table command is used to delete a table structure. Drop table command execute only

on empty table. To remove the content DELETE command is used.

7. What is the difference between the working of following functions?

count(*), count (<column name>), count(DISTINCT), count(ALL)

Ans. count(*) - to count total number of rows in a table

count(<column name>) – to count number of values in a column

count(DISTINCT) – to count unique values in a column

count(ALL) – to count the number of value in a column (includes repeating values)

8. What is the difference between WHERE and HAVING clause?

Ans. The HAVING clause places conditions on groups in contrast to WHERE clause that places

conditions on individual rows. WHERE conditions cannot include aggregate functions, HAVING

conditions can do so.

9. Difference between char(n) and varchar2(n).

Ans. char data type declare the variable as fixed length whereas varchar2 declares variable as

variable length. When a column is given a data type as char(n), then ORACLE ensures that all

values stored in that columns have this length i.e n bytes. If a value is shorter than this length i.e

n blanks are added. But the size of value remains n bytes.

10. Difference between VIEW and TABLE.

Ans. View is a virtual table that doesn’t have existence of its own. It takes data from the base

table using SELECT command. A table is relation that has physical existence of its own and is

used to store data.

11. What is the difference between unique constraint and primary key constraint?

Ans. Unique key constraint ensures that no two rows have the same value in the specified

columns similar to primary key but primary key cannot allow NULL values. A table can have

only one primary key but Unique key can be more than one.

12. What is the use of ORDER BY clause?

Ans.Use of ORDER BY clause:-

Results of SQL query can be sorted in a specific order using ORDER BY clause

The ORDER BY clause allows sorting of query results by one or more columns

34

The sorting can be done either in ascending or descending order

LONG ANSWER TYPE QUESTIONS (4 marks)

1. Consider the following tables GAMES and PLAYER. Write SQL commands for the

statement (i) to (iv) and give outputs for SQL queries (v) to (vii).

Table: GAMES

GCode GameName NoOfParticipant PrizeMoney ScheduleDate

101 Carom Board 2 5000 23-Jan-2004

102 Badminton 2 12000 12-Dec-2003

103 Table Tennis 4 8000 14-Feb-2004

104 Chess 2 9000 01-Jan-2004

108 Lawn Tennis 4 25000 19-Mar-2004

Table: PLAYER

PCode Name GCode

1 Nabi Ahmad 101

2 Ravi Sahai 108

3 Jatin 101

4 Nazneen 103

(i) To display the name of all Games with their GCodes.

Ans. Select GCode, GameName from GAMES;

(ii) To display details of those games which are having PrizeMoney more than

7000.

Ans. Select * from GAMES where PrizeMoney > 7000;

(iii) To display the content of the GAMES table in ascending order of

ScheduleDate.

Ans. Select * from GAMES order by ScheduleDate ASC;

(iv) To display sum of PrizeMoney for each of the Number of participation

groupings.

Ans Select sum(PrizeMoney) from Games group by NoOfParticipant;

(v) Select count (Distinct NoOfParticipant) from GAMES.

Ans. COUNT(Distinct NoOfParticipant)

2

(vi) Select Max(ScheduleDate), Min(ScheduleDate) from GAMES.

Ans. Max(ScheduleDate) Min(ScheduleDate)

19-Mar-2004 12-Dec-2003

(vii) Select Sum(PrizeMoney) from GAMES.

Ans. Sum(PrizeMoney

59000

(viii) Select distinct GCode from PLAYER.

35

DISTINCT GCode

101

103

108

2. Study the following tables DOCTOR and SALARY and write SQL commands for the

questions (i) to (iv) and give outputs for SQL queries (v) to (vi).

TABLE: DOCTOR

ID NAME DEPT SEX EXPERIENCE

101 John ENT M 12

104 Smith ORTHOPEDIC M 5

107 George CARDIOLOGY M 10

114 Lara SKIN F 3

109 K George MEDICINE F 9

105 Johnson ORTHOPEDIC M 10

117 Lucy ENT F 3

111 Bill MEDICINE F 12

130 Morphy ORTHOPEDIC M 15

TABLE: SALARY

ID BASIC ALLOWANCE CONSULTATION

101 12000 1000 300

104 23000 2300 500

107 32000 4000 500

114 12000 5200 100

109 42000 1700 200

105 18900 1690 300

130 21700 2600 300

(i) Display Name of all doctors who are in “MEDICINE” having more than 10

years experience from the table DOCTOR.

Ans. Select Name from DOCTOR where DEPT= “MEDICINE” and

EXPERIENCE>10;

(ii) Display the average salary of all doctors working in “ENT” department using

the tables DOCTOR and SALARY. Salary= BASIC + ALLOWANCE.

Ans. Select avg(S.BASIC + S.ALLOWANCE) , D.DEPT from DOCTOR D, SALARY S

where D.ID= S.ID;

(iii) Display the minimum ALLOWANCE of female doctors.

Ans. Select min(S.ALLOWANCE) from DOCTOR D,SALARY S where D.SEX= “F”

and D.ID=S.ID;

36

(iv) Display the highest consultation fee among all male doctors.

Ans. Select max(S.Consultation) from DOCTOR D, SALARY S where D.Sex=”M” and

D.ID=S.ID;

(v) Select count(*) from DOCTOR where SEX = “F”.

Ans. COUNT(*)

4

(vi) Select NAME, DEPT, BASIC from DOCTOR, SALARY where DEPT= ‘ENT’

and DOCTOR.ID= SALARY.ID.

Ans. NAME DEPT BASIC

John ENT 12000

3. Study the following table CLUB and ACTIVITY and write SQL commands for questions (i)

to (iv) and give outputs for SQL queries (v) to (vi):

Table: CLUB Mcode Mname Sex Age Fees Activity_code Type

1 Granth Male 35 7000 A001 Monthly

2 Ananya Female 25 8000 A003 Monthly

3 Triveni Female 42 24000 A001 Yearly

4 Hansia Female 27 12000 A001 Quarterly

5 Tarun Male 54 6000 A002 Monthly

6 Mani Male 43 4500 A002 Monthly

7 Farah Female 22 500 A005 Guest

8 Vipin Male 51 24000 A002 Yearly

9 Harshan Male 44 1000000 A003 Life Time

Table: Activity

Activity_code Activity_name

A001 Swimming

A002 Cricket

A003 Skating

A004 Table tennis

A005 Badminton

i. Display the Mname, Age and Fees of those members of the CLUB whose Fees is

between 6000 to 10000.

Ans. Select Mname, Age, fees from CLUB where Fees between 6000 and 10000;

ii. Display Mname, fees and activity_name of all Female of the CLUB with Mname in

ascending order.

Ans. Select C.Mname, C.Fees, A.Activity_Name from CLUB C, ACITIVITY A where

C.SEX=”Female” and C.Activity_Code= A. Activity_Code;

iii. Display Mname, Fees of all those members of the CLUB whose age< 40 and are

Monthly type members of the CLUB.

Ans. Select Mname, Fees from Club where age<40 and Type=”Monthly”;

iv. To insert a new tuple in the table CLUB with the following data:

11, “Keshav”, “Male”, 27, 600, “Guest”

Ans. Insert Into CLUB (Mcode,MName, Age, Fees, Type) VALUES (11, ‘Keshav’,

‘Male’, 27, 600, ‘Guest’)

v. Select Sum(Fees) from CLUB where age> 40.

Ans. Sum(Fees)

37

1058500

vi. Select avg(age) from CLUB where type= “Yearly”

Ans. AVG(age)

46.5

4. Table: SPORTS

i.Display the name of the students who have grade1 C

Ans. Select STUDENT NAME from SPORTS where grade1=”C” ;

ii.Display the number of students getting grade1 A in Cricket.

Ans. Select count(distinct STUDENT NAME) from SPORTS where GRADE1=’A’ and

Game1=’Cricket’orGame2=’Cricket’;

iii.Display the names of the students who have same game for both game 1and game2

Ans. Select STUDENT NAME from SPORTS where game1=game2;

iv. Display the game taken up by the students whose name starts with A

Ans.Select Game1,Game2 from SPORTS where Game1=’A%’ or Game2=’A%’;

v.Add a new column named ‘marks’

Ans.Alter Table SPORTS add marks number(3);

vi. Assign a value 200 for ‘marks’ for those who are getting Grade A in both game 1 and

game 2

Ans.update Sports set marks=200 where grade1=’A’ and Grade2=’A’;

vii. Arrange the whole table in the Alphabetical order of the name.

Ans:Select * from sports where Order by STUDENT NAME;

viii.display the name of the students who got 200 mark

Ans: Select STUDENT NAME from Sports where mark=200;

ix Display the names of the students in upper case

Ans Select UPPER(STUDENT NAME) From Sports;

STUDENT

NO

CLASS STUDENT

NAME

GAME1 GRADE1 GAME 2 GRADE2

10 7 Sammer Cricket B Swimming A

11 8 Sujit Tennis A Skating C

12 7 Kamal Swimming B Football B

13 7 Venna Tennis C Tennis A

14 9 Archana Basketball A Cricket A

15 10 Arpit Cricket A Athletics C

38

POINTS TO REMEMBER:

SQL is a language that enables you to create and operate on relational databases.

The various processing capabilities of SQL are:

data definition language (DDL), interactive and embedded data manipulation language

(DML), view definition, authorization, integrity and transaction control.

The DDL provides statements for the creation and deletion of tables and indexes.

The DML provides statements to enter, update, delete data and perform complex queries on

these tables

The CREATE TABLE command creates a new table.

The SELECT command lets you make queries on the database. Rows returned are restricted

using WHERE clause.

Results are sorted using ORDER BY clause and the GROUP BY clause divides the result

obtained into groups and the HAVING clause sets condition for the GROUP BY clause.

The rows are added to relations using INSERT command

The rows are removed from a relation using DELETE command.

The UPDATE command lets you change some or all of the values in an existing row.

The CREATE VIEW creates view from a table.

The ALTER TABLE changes the definition of an existing table.

The DROP TABLE drops a table from the database

The DROP VIEW drops a view from the database

39

CHAPTER 13

BOOLEAN ALGEBRA

FORE VIEW

POINTS OF FOCUS

SOLVED EXAMPLES

POINTS TO REMEMBER

40

FOREVIEW

Truth Table

Truth table is a table which represents all the possible values of logical variables /statements

along with all the possible results of the given combinations of values.

TAUTOLOGY

If result of any logical statement or expression is always TRUE or 1 then it is called

Tautology.

FALLACY

If result of any logical statement or expression is always FALSE or 0, it is called Fallacy.

Logic Gate

A Gate is simply an electronic circuit which operates on one or more signals to produce an

output signal.

Inverter (NOT Gate)

An inverter (NOT gate) is a gate with only one input signal and one output signal. The output

signal is always the opposite of the input state.

OR Gate

The OR Gate has two or more input signals but only one output signal. If anyone input signal

is high (1) then output signal will be high (1).

AND Gate

The AND Gate has two or more input signals but only one output signal. If anyone input

signal is low (0) then output signal will be low otherwise high

PRINCIPLE OF DUALITY

This states that starting with a Boolean relation another Boolean relation can be derived by.

BASIC THEOREMS OF BOOLEAN ALGEBRA

(1) Properties of 0 and 1

(2) Indempotence Law

(3) Involution

(4) Complementarity Law

(5) Commutative Law

(6) The Associative Law

(7) The Distributive Law

(8) Absorption law

41

DEMORGAN’S THEOREMS

Minterms

Minterms is a product of all the literals (with or without the bar) within the logic system.

Maxterms

Maxterm is a sum of all the literals (with or without the bar) within the logic system.

Canonical Expression

Boolean expression composed entirely either of minterms or Maxterm is referred to as

canonical expression. Canonical expression can be represented in two forms:

Canonical Sum of Products form

When a Boolean expression is represented purely as sum of minterms (Product terms), it is

said to be canonical Sum of Product form.

Karnaugh map

Karnaugh map or K – map is a graphical display of the fundamental products in a truth table.

K – Map is nothing but a rectangle made up of certain number of squares represents a Maxterm

or minterm.

NAND and NOR Gates

NAND and NOR gates can greatly simplify circuit diagrams. As we will see you can use

these gates wherever you could use AND, OR, and NOT.

XOR and XNOR Gates

XOR is used to choose between two mutually exclusive inputs. Unlike OR, XOR is true

only when one input or the other is true, not both

42

POINTS OF FOCUS BOOLEAN ALGEBRA

TRUTH TABLE

Truth table is a table which represents all the possible values of logical variables /statements

along with all the possible results of the given combinations of values.

Eg:

X Y R

1 1 1

1 0 0

0 1 0

0 0 0

1 represents TRUE and 0 represents FALSE.

TAUTOLOGY

If result of any logical statement or expression is always TRUE or 1, it is called Tautology.

FALLACY

If result of any logical statement or expression is always FALSE or 0, it is called Fallacy.

NOT OPERATOR

This Operator operates on single varibles.

Truth Table

X R

0 0

1 1

OR OPERATOR

Operator denotes operation called logical addition.

X Y X+ Y

0 0 0

0 1 1

1 0 1

43

1 1 1

AND OPERATOR

AND Operator denotes operation called logical Multiplication.

X Y X . Y

0 0 0

0 1 0

1 0 0

1 1 1

Evaluation of Boolean Expressions Using Truth Table.

1. X + (Y.Z)’

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

0 0 0 0 1 1

0 0 1 0 1 1

0 1 0 0 1 1

0 1 1 1 0 0

1 0 0 0 1 1

1 0 1 0 1 1

1 1 0 0 1 1

1 1 1 1 0 1

BASIC LOGIC GATES

Logic Gate

A Gate is simply an electronic circuit which operates on one or more signals to produce an

output signal.

There are three types of logic gates:-

1. Inverter (NOT Gate)

2. OR gate

3. AND gate

Inverter (NOT Gate)

An inverter (NOT gate) is a gate with only one input signal and one output signal. The output

signal is always the opposite of the input state.

44

Truth Table of NOT Gate

X X’

0 0

1 1

NOT Gate Symbol

OR Gate

The OR Gate has two or more input signals but only one output signal. If anyone input signal

is high (1) then output signal will be high (1).

X Y X+ Y

0 0 0

0 1 1

1 0 1

1 1 1

OR Gate Symbol

AND Gate

The AND Gate has two or more input signals but only one output signal. If anyone input

signal is low (0) then output signal will be low otherwise high

X Y X. Y

0 0 0

45

0 1 0

1 0 0

1 1 1

AND Gate Symbol

BASIC POSTULATES OF BOOLEAN ALGEBRA

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 = 1

1 . 0 = 1

1 . 1 = 1

IV. Complement rules

0’ = 1

1’ = 0

PRINCIPLE OF DUALITY

This states that starting with a Boolean relation another Boolean relation can be derived by

1. Changing each OR sign to an AND sign.

2. Changing each AND sign to OR sign.

3. Replacing each 0 by 1 and each 1 by 0.

The derived relation using duality principal is called dual of original expression.

BASIC THEOREMS OF BOOLEAN ALGEBRA

(1) Properties of 0 and 1

46

(a) 0 + X = X

(b) 1 + X = 1

(c) 0 . X = 0

(d) 1. X = X

(2) Indempotence Law

(a) X + X = X

(b) X . X = X

Proof

(a) X + X = X

X X R

0 0 0

1 1 1

Proof

(b) X . X = X

X X R

0 0 0

1 1 1

(3) Involution

X’’ = X

Proof

X X’ X’’

0 1 0

1 0 1

(9) Complementarity Law

(a) X + X’ = 1

(b) X . X’ = 0

Proof

X X’ X+X’

0 1 1

1 0 1

X X’ X.X’

47

0 1 0

1 0 0

(10) Commutative Law

i. X + Y= Y + X

X Y X + Y Y + X

0 0 0 0

0 1 1 1

1 0 1 1

1 1 1 1

ii. X.Y = Y. X

X Y X.Y Y.X

0 0 0 0

0 1 0 0

1 0 0 0

1 1 1 1

(11) The Associative Law

(i) X + (Y + Z) = (X + Y) + Z (ii) X(YZ) =(XY)Z

Truth table for X+(Y+Z) = (X+Y)+Z is given below :

Input Output

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

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

0

1

1

1

0

0

0

1

1

1

0

1

1

1

1

0

1

1

1

1

48

1 0 1

1 1 0

1 1 1

1

1

1

1

1

1

1

1

1

1

1

1

Comparing the columns X+(Y+Z) and (X+Y)+Z, we see both of these are identical, Hence

proved. Since (i) is proved, (ii) is dual of rule (ii), hence it is also proved.

(12) The Distributive Law

(i) X(Y+Z) = XY+XZ (ii) X+YZ =(X+Y)(X+Z)

Truth table for X(Y+Z) = XY+XZ are given below:

Input Output

X Y Z Y+Z XY XZ X(Y+Z) XY+XZ

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

0

1

1

1

0

1

1

1

0

0

0

0

0

0

1

1

0

0

0

0

0

1

0

1

0

0

0

0

0

1

1

1

0

0

0

0

0

1

1

1

Both the columns X(Y+Z) and XY+YZ are identical, hence proved.

The algebraic proof of law X+YZ=(X+Y)(X+Z)

RHS = (X+Y)(X+Z)

=XX+XZ+XY+YZ

=X+XZ+XY+YZ

=X+XY+XZ+YZ

=X(1+Y)+Z(X+Y)

=X.1+Z(X+Y)

49

=X+XZ+YZ=X(1+Z)+YZ

=X +YZ

= LHS, Hence proved.

Eg: State Distributive law and verify the same using truth table.

Ans. If X, Y, Z are Boolean Variables then

X.(Y + Z) = X.Y + X.Z or 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

0 0 1 1 0 0 0 0

0 1 0 1 0 0 0 0

0 1 1 1 0 0 0 0

1 0 0 0 0 0 0 0

1 0 1 1 1 0 1 1

1 1 0 1 1 1 0 1

1 1 1 1 1 1 1 1

(13) Absorption law

(i) X+XY = X (ii) X(X+Y) =X

(i) Truth table for X+XY = X is given below :

Input Output

X Y XY X+XY

0 0

0 1

1 0

0

0

0

0

0

1

50

1 1 1 1

Both the columns X+XY and X are identical, hence proved.

(ii) Truth table for X.(X+Y) = X is given below :

Input Output

X Y X+Y X(X+Y)

0 0

0 1

1 0

1 1

0

1

1

1

0

0

1

1

Column X and X(X+Y) are identical, hence proved.

DEMORGAN’S THEOREMS

1. Demorgan’s First Theorem

(X+Y)’ = X’Y’

Proof

(X+Y)+(X’Y’) = 1

(X+Y)+X’Y’=((X+Y)+X’).((X+Y)+Y’)

= (X+X’+Y).(X+Y+Y’)

= (1+Y).(X+1)

= 1.1

= 1

(X+Y).(X’Y’) = 0

(X+Y).(X’Y’) = X’Y’.(X+Y)

= X’Y’X+X’Y’Y

51

= 0.Y+X’.0

= 0

Hence proved

2. Demorgan’s Second Theorem

(X.Y)’ = X’+Y’

Proof

XY + (X’+Y’) = 1

=(X’+Y’)+XY

=(X’+Y’+X).(X’+Y’+Y)

=(X+X’+Y’).(X’+Y+Y’)

=(1+Y’).(X’+1)

=1.1

=1

XY. (X’+Y’) = 0

= XY.( X’+Y’) ->X(Y+Z)=XY+XZ

= XYX’+XYY’

= 0.Y+X.0

= 0+0

= 0

Note:- Find the dual of the following expression.

(X+Y)+Z=X+(Y+Z)

The dual is (X.Y).Z=X.(Y.Z)

Derivation of Boolean expression

1) Minterms

Minterms is a product of all the literals (with or without the bar) within the logic system.

Example: Convert X+Y to minterm

X+Y

= X.1+Y.1 (Because X.1 = X)

= X.(Y+Y’)+Y.(X+X’) (Because X+X’ = 1)

= XY+XY’+XY+X’Y By Distributive law

= XY+XY’+X’Y (Because X+X = X)

2) Maxterms

Maxterm is a sum of all the literals (with or without the bar) within the logic system.

52

Example:

If the value of the variables are X=0, Y=1 and Z=1 then the Maxterm will be X+Y’+Z’

3) Canonical Expression

Boolean expression composed entirely either of minterms or Maxterm is referred to as

canonical expression. Canonical expression can be represented in two forms:

i) Sum – of – Products (SOP) form

ii) Product – of – Sum (POS) form

Canonical Sum of Products form

When a Boolean expression is represented purely as sum of minterms (Product terms), it

is said to be canonical Sum of Product form.

Truth table for Product Terms (3 input)

X Y Z Product

Terms/

Minterms

0 0 0 X’Y’Z’

0 0 1 X’Y’Z

0 1 0 X’YZ’

0 1 1 X’YZ

1 0 0 XY’Z’

1 0 1 XY’Z

1 1 0 XYZ’

1 1 1 XYZ

Canonical sum of products expression can also be represented by the following Short hand

notation.

Example: - F=∑(1,4,5,6,7)

= m1 + m4 + m5 + m6 + m7

= 001 + 100 + 101 + 110 + 111 (Boolean values for decimal numbers)

= X’Y’Z + XY’Z’+ XY’Z+XYZ’+XYZ

Canonical Product of sum form

When a Boolean expression is represented purely as product of maxterms, it is said to be

in canonical Product of Sum form of expression.

Truth table for Sum Terms (3 input)

X Y Z Sum Terms/

53

Maxterms

0 0 0 X+Y+Z

0 0 1 X+Y+Z’

0 1 0 X+Y’+Z

0 1 1 X+Y’+Z’

1 0 0 X’+Y+Z

1 0 1 X’+Y+Z’

1 1 0 X’+Y’+Z

1 1 1 X’+Y’+Z’

Canonical product of sum expression can also be represented by the following Short hand

notation.

Example(1): - F=∏ (1,4,5,6,7)

=M1 . M4. M5. M6.M7

= 001 + 100 + 101 + 110 + 111 (Boolean values for decimal numbers)

= (X+Y+Z’)( X’+Y+Z)( X’+Y+Z’)( X’+Y’+Z)( X’+Y’+Z’)

Minimization of Boolean expression

1) Algebraic method

Example : - Reduce X’Y’Z’ + X’YZ’ + XY’Z’ + XYZ’

= X’(Y’Z’ + YZ’) + X(Y’Z’+YZ’)

=X’(Z’(Y’+Y)) + X(Z’(Y’+Y))

=X’(Z’.1)+X(Z’.1)

=X’Z’+XZ’

=Z’(X’+X’)

=Z’.1

=Z’

2) Simplification using karnaugh maps

Karnaugh map

Karnaugh map or K – map is a graphical display of the fundamental products in a truth table.

K – Map is nothing but a rectangle made up of certain number of squares represents a Maxterm

or minterm

SOP reduction using K-maps

For a function of n variables, there would be a map of 2n squares each represents a minterm.

Following are two, three, four variables k-maps for SOP reduction.

54

Two variables

Y’ Y

X’

X

Three variables

Y’Z’ Y’Z YZ YZ’

X’

X

Four variables

Y’Z’ Y’Z YZ YZ’

W’X’

W’X

WX

WX’

Example:

1) Reduce the following Boolean expression using K-Map

F(U,V,W,Z) = ∑ (0, 1, 2, 3, 4, 10, 11)

X’Y’ 0 X’Y 1

XY’ 2 XY 3

X’Y’Z’

0

X’Y’Z

1

X’YZ

3

X’YZ’

2

XY’Z’

4

XY’Z

5

XYZ

7

XYZ’

6

W’X’Y’Z’

0

W’X’Y’Z

1

W’X’YZ

3

W’X’YZ’

2

W’XY’Z’

4

W’XY’Z

5

W’XYZ

7

W’XYZ’

6

WXY’Z’

12

WXY’Z

13

WXYZ

15

WXYZ’

14

WX’Y’Z’

8

WX’Y’Z

9

WX’YZ

11

WX’YZ’

10

55

Ans.

2) Obtain the simplified form of a boolean expression using Karnaugh map.

F(U,V,W,X) = ∑ (0,3, 4, 5, 7, 11, 13, 15)

[00]W’Z’ [01] W’Z [11]WZ [10]WZ’

1 1

1 1 1

1 1

1

2 quads, 1 pair.

Quad 1(m3+m7+m11+m15) reduces to WZ

Quad 2(m5+m7+m13+m15) reduces to VZ

Pair 1(m0,m4) reduces to U’W’Z’

Therefore F=WZ + VZ + U’W’Z’

POS reduction using K-maps : -

For a function of n variables, there would be a map of 2n squares each represents a maxterm.

Following are two, three, four variables k-maps for POS reduction.

Two variables

Y Y’

X+Y X+Y’

[00] U’V’

[01] U’V

[11] UV

[00] UV’

56

X

X’

Three variables Y+Z Y+Z’ Y’+Z’ Y’+Z

X

X’

Four variables

Y+Z Y+Z’ Y’+Z’ Y’+Z

W+X

W+X’

W’+X’

W’+X

More about Logic Gates

NAND and NOR Gates

NAND and NOR gates can greatly simplify circuit diagrams. As we will see you can use

these gates wherever you could use AND, OR, and NOT.

NAND Gate:-

The NAND gate has two or more input signals but only one output signal. If all of the inputs

are (high), then the output produced is 0 (low).

0 1

X’+Y

2

X’+Y’

3

X+Y+Z

0

X+Y+Z’

1

X+Y’+Z’

3

X+Y’+Z

2

X’+Y+Z

4

X’+Y+Z’

5

X’+Y’+Z’

7

X’+Y’+Z

6

W+X+Y+Z

0

W+X+Y+Z’

1

W+X+Y’+Z’

3

W+X+Y’+Z

2

W+X’+Y+Z

4

W+X’+Y+Z’

5

W+X’+Y’+Z’

7

W+X’+Y’+Z

6

W’+X’+Y+Z

12

W’+X’+Y+Z’

13

W’+X’+Y’+Z’

15

W’+X’+Y’+Z

14

W’+X+Y+Z

8

W’+X+Y+Z’

9

W’+X+Y’+Z’

11

W’+X+Y’+Z

10

57

NAND

NOR Gates:-

The NOR gates has two or more input signals but only one output signal. If all inputs are 0

(i.e., low), then the output signal is 1 (high).

NOR

XOR and XNOR Gates

XOR is used to choose between two mutually exclusive inputs. Unlike OR, XOR is true only when

one input or the other is true, not both

A B AB

0 0 0

00 11 11

11 00 11

11 11 00

11 00 00

AABB BB AA

00 11 11

00 00 11

00 11 00

11 00 00

AABB BB AA

58

XOR Gate (Exclusive OR gate):-

The XOR gate can also have two or more inputs but

produces one output signal. Exclusive-OR gate

different from OR gate. OR gate produces output 1 for

any input combination having one or more 1’s, but XOR gate produces output 1 for only

those input combinations that have odd number 1’s.

XOR

XNOR Gate (Exclusive NOR gate)

The XNOR Gate is logically equivalent to an inverted XOR i.e., XOR gate followed by a

NOT gate (inventor). Thus XNOR produces 1 (high) output when the input combination has

even number of 1’s.

XNOR

SOLVED PROBLEMS

0 1 1

1 0 1

1 1 0

A B A B

0 0 1

0 1 0

1 0 0

1 1 1

59

1 mark Questions

1) Why are AND and NOR gates called Universal gates? (1)

Ans. NAND and NOR gates are less expensive and easier to design. Also, other switching

functions (AND, OR) can easily be implemented using NAND/NOR gates. Thus, these

(NAND, NOR) gates are also reffered to as Universal Gates.

(2) Write the Sum of Products form of the function G(U,V,W). Truth table representation

of G is as follows: (1)

U V W G

0 0 0 0

0 0 1 0

0 1 0 1

0 1 1 0

1 0 0 1

1 0 1 0

1 1 0 1

1 1 1 1

Ans. To get the product of sums form, we need to add maxterms for all those input combinations

that produce output as 0. Thus ,

G(U,V,W) = (U + V + W) (U + V + W’) (U + V’ + W’) (U’ + V + W’)

(3) Convert P+Q’R to product of sum

Ans:

P+Q’R=(P+Q’) (P+R’) [ by the rule A+BC= (A+B)(A+C)

=(P+Q’+RR’) ( P+QQ’+R) [ by the rule AA’=0

= (P+Q’+R) (P+Q’+R’) (P+Q+R) (P+Q’+R) [ by the rule A+BC= (A+B)(A+C)

60

(4) Concert X+YZ into sum of product

Ans:

X+YZ=X.1+YZ.1 [by the rule A.1=A

= X(Y+Y’)+YZ(X+X’) [ by the rule A+A’=1

=XY+XY’+YZX+YZX’

=XY.1+XY’.1+XYZ+YZX’ [by the rule A.1=A

=XY(Z+Z’)+XY’(Z+Z’)+XYZ+X’YZ [ by the rule A+A’=1

=XYZ+XYZ’+XY’Z+XY’Z’+XYZ+X’YZ

2 marks Questions

(1) Write the equivalent Boolean Expression for the following Logic circuit.

(2)

2) Prove that X.(X+Y)=X by truth table method. (2)

Ans.

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

61

0 0 0 0

0 1 1 0

1 0 1 1

1 1 1 1

From the above table it is obvious that X.(X+Y) = X because both the columns are identical.

3) Prove that X.(X+Y)=X by algebric method (2)

Ans. LHS = X.(X+Y)

= X.X+X.Y

=X+X.Y

=X.(1+Y)

=X.1 = X = RHS

4) State the distributive laws of Boolean algebra. How are they different from distributive

laws of ordinary algebra. (2)

Ans. Distributive laws of Boolean algebra state that

i. X(Y+Z) = XY+XZ

ii. X+YZ =(X+Y)(X+Z)

Ist law X(Y+Z) = XY+XZ holds good for all values of X, Y and Z in ordinary algebra

whereas X+YZ =(X+Y)(X+Z) holds good only for two values (0,1) of X, Y and Z.

5) In Boolean algebra, verify using truth table that (X + Y)’ = X’ Y’ for each X, Y in (0, 1).

(2)

Ans. As it is a 2-variable expression, truth table will be as follows :

X Y X+Y (X+Y)’ X’ Y’ X’Y’

0 0 0 1 1 1 1

0 1 1 0 1 0 0

62

1 0 1 0 0 1 0

1 1 1 0 0 0 0

6) State Demorgan’s laws. Verify one of the Demorgan’s laws using truth tables. (2)

Ans. De Morgan’s first theorem. It states that X + Y = X . Y

De Morgan’s second theorem. It states that X . Y = X + Y

Truth table for second theorem

X Y X.Y X.Y X Y X+Y

0 0 0 1 1 1 1

0

1

1

0

0

0

1

1

1

0

0

1

1

1

1 1 1 0 0 0 0

X.Y and X+Y are identical.

7) Draw the logic circuit diagram for the following expression : (2)

Y = a b + b c + c a

8) Prepare a truth table for X’ Y Z’ + X Y’ (2)

Ans. Truth table for is given below :

Input Output

63

(9) Write the equivalent expression for the following logic circuit : (2)

Ans. F=(AC)’ +(BA)’+(BC)’

(10) Write the equivalent expression for the following logic circuit: (2)

X Y Z X’ Y’ Z’ X’YZ’ XY’ X’YZ’ + XY’

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

1

1

1

1

0

0

0

0

1

1

0

0

1

1

0

0

1

0

1

0

1

0

1

0

0

0

1

0

0

0

0

0

0

0

0

0

1

1

0

0

0

0

1

0

1

1

0

0

64

Ans. (X + Y’)(X’ + Y)(X’ + Y’)

4 marks Questions

(1) Obtain the simplified form of a boolean expression using Karnaugh map. (4)

F(u,v,w,x) = ∑ (0, 3, 4, 5, 7, 11, 13, 15)

[00]W Z [01] W Z [11]W Z [10]W Z

1 1

1 1 1

1 1

1

2 quads, 1 pair.

Quad 1(m3+m7+m11+m15) reduces to WZ

Quad 2(m5+m7+m13+m15) reduces to VZ

Pair 1(m0,m4) reduces to UWZ

Therefore F=WZ + VZ + UWZ

9) By means of truth table, demonstrate the validity of the following Postulates / Laws of

Boolean algebra: (4)

a. Commulative law

b. Idempotent law

Ans.

(a) The commulative law states that

(i) X+Y = Y+X (ii) X.Y =Y.X

(i) Truth table for X+Y = Y+X is given below :

[00] U V

[01] U V

[11] U V

[00] U V

65

Input Output

X Y X+Y Y+X

0 0 0 0

0 1 1 1

1 0 1 1

1 1 1 1

Comparing the columns X+Y and Y+X, we see both of these are identical. Hence proved.

(ii) Truth table for X.Y = Y.X is given below:

Input Output

X Y X.Y Y.X

0 0 0 0

0 1 0 0

1 0 0 0

1 1 1 1

Comparing the columns X.Y and Y.X, we see both of these are identical. Hence proved.

(b) The Idempotent law states that

(i) X+X = X ii) X.X =X

(i) Truth table for X+X = X is given below :

Input Output

X X X+X

0 0

1 1

0

1

(ii) Truth table for X.X = X is given below :

66

Input Output

X X X.X

0 0

1 1

0

1

POINTS TO REMEMBER

Binary Decision

Logical Statements

TRUTH TABLE :-Truth table is a table which represents all the possible values of logical

variables /statements along with all the possible results of the given combinations of values

TAUTOLOGY:-If result of any logical statement or expression is always TRUE or 1, it is

called Tautology.

FALLACY : - If result of any logical statement or expression is always FALSE or 0, it is

called Fallacy.

PRINCIPLE OF DUALITY

This states that starting with a Boolean relation another Boolean relation can be derived by

1. Changing each OR sign to an AND sign.

2. Changing each AND sign to OR sign.

3. Replacing each 0 by 1 and each 1 by 0.

The derived relation using duality principal is called dual of original expression.

BASIC THEOREMS OF BOOLEAN ALGEBRA

(4) Properties of 0 and 1

(5) 0+x=x

(6) 1+x=1

(7) 0.x=0

(8) 1.x=x

(9) Indempotence law

(a) x+x=x

67

(b) x.x=x

Involution

x’’=x

Complementarity law

(a) x+x’=1

(b) x.x’= 0

Cummtative law

x + y= y+x

The associative law

(i) X+(Y+Z) = (X+Y)+Z (ii) X(YZ) =(XY)Z

The distributive law

(i) X(Y+Z) = XY+XZ (ii) X+YZ =(X+Y)(X+Z)

Absorption law

(i) X+XY = X (ii) X(X+Y) =X

DEMORGAN’S THEOREMS

(X+Y)’=X’Y’

(X.Y)’=X’+Y’

Minterms: - Minterms is a product of all the literals (with or without the bar) within the

logic system.

Maxterms: - Maxterm is a sum of all the literals (with or without the bar) within the logic

system

Canonical sum of product form:- When a Boolean expression is represented purely as sum

of minterms or product terms, it is said to be canonical sum of product form.

Canonical Product of sum form: - When a Boolean expression is represented purely as

product of maxterms, it is said to be in canonical product of sum form of expression.

NOR Gates:-

The NOR gates has two or more input signals but only one output signal. If all inputs are 0

(i.e., low), then the output signal is 1 (high).

NAND Gate:-

68

The NAND gate has two or more input signals but only one output signal. If all of the

inputs are (high), then the output produced is 0 (low).

XOR Gate (Exclusive OR gate):-

The XOR gate can also have two or more inputs but produces one output signal. Exclusive-

OR gate different from OR gate. OR gate produces output 1 for any input combination having

one or more 1’s, but XOR gate produces output 1 for only those input combinations that have

odd number 1’s.

XNOR Gate (Exclusive NOR gate)

The XNOR Gate is logically equivalent to an inverted XOR i.e., XOR gate followed by a

NOT gate (inventor). Thus XNOR produces 1 (high) output when the input combination has

even number of 1’s.

69

CHAPTER 14

COMMUNICATION & NETWORK CONCEPTS

FORE VIEW

POINTS OF FOCUS

SOLVED EXAMPLES

POINTS TO REMEMBER

70

FORE VIEW

Computer Network -computer network is an interconnected collection of devices that enables you

to store, retrieve, and share information.

Network interface card handles the connection to the network itself through one or more

connectors on the backplane of the card.

A Hub is a multipurpose network device that lies at the centre of a network to channel the traffic

from one computer to another.

A Repeater is a network device that boosts the power of incoming signals to allow the length of a

network to be extended.

A Bridge is a network device capable of connecting networks that use similar protocols. It connects

two local area networks running the same network operating system.

A Router is a network device that connects LAN’s, that may be running on different operating

systems, into an inter network and routes traffic between them.

A Gateway forwards data between IP networks. It is a machine that acts as an interface between a

small network and a much larger one.

A Backbone is a set of nodes and links connected together comprising a network, or the upper layer

protocols used in a network.

Modems provide the means to transmit digital computer data over analog transmission media, such

as ordinary, voice-grade telephone lines

On an inter network, data units must be switched through the various intermediate devices until they

are delivered to their destination. Two contrasting methods of switching data are commonly used

Circuit Switching and Packet Switching.

Circuit-switching a type of network in which a physical path is obtained for and dedicated to a

single connection between two end-points in the network for the duration of the connection.

Packet-switching Breaking communication down into packets allows the same data path to be

shared among many users in the network.

Twisted-pair wiring refers to a type of cable composed of two (or more) copper wires twisted

around each other within a plastic sheath.

This type of cable is referred to as "coaxial" because it contains one copper wire (or physical data

channel) that carries the signal and is surrounded by another concentric physical channel consisting

of a wire mesh or foil. The outer channel serves as a ground for electrical interference.

71

Optical fiber cable can transmit data over very long distances with little loss in data integrity by

the mean of light transmission.

Microwave transmitters and receivers, especially satellite systems, are commonly used to transmit

network signals over great distances. A microwave transmitter uses the atmosphere or outer

space as the transmission medium to send the signal to a microwave receiver.

Infrared transmit light waves rather than radio waves, they require a line-of-sight transmission

path.

Local Area Networks (LAN) is a number of devices (Computers, Printers, Fax) that are

connected to each other by some form of wiring, within a localized area (within building

e.g. a school, an office etc. ) to share data and resources.

Wide Area Networks (WAN) is a number of local area networks that are connected to form a large,

logical network without any geographical limitation.

In a Metropolitan Area Network computer connected to each other with in a city to have the

organization concentric needs. Though the distance between the devices is not very large, they can

have their own cabling plan.

72

POINTS OF FOCUS

Introduction

On the most fundamental level, a computer network is an interconnected collection of computer

systems that enables you to store, retrieve, and share information.

Overview

Evolution of Networking

Advance Research Project Network

ARPANET: In 1969, the first computer network was created. Called ARPANET (Advanced

Research Projects And Network, it interconnected UCLA, Stanford Research Institute, and

UC Santa Barbara in California with the University of Utah.

Internet: Network of Networks connected word-wide is internet.

Interspace: It is a client/ server software which allows real time interface access.

Different ways of sending data across the network

Circuit switching techniques

Packet Switching techniques

Data Communication terminologies

Concept of Channel, Baud, Bandwidth (Hz, KHz, MHz)

Data transfer rate (bps, kbps, Mbps, Gbps, Tbps)

Transmission Media

Guided Media

Twisted pair cable

Coaxial cable – Thin and Thick Coaxial

Optical fiber

Non Guided Media

Infrared

radio link

microwave link

satellite link

Network devices

Modem,

RJ45 connector

Ethernet Card

Hub

Switch

Gateway

Different Topologies

Bus

Star

Tree

Mesh

Types of Networks

73

LAN

WAN

MAN

Protocol:

TCP/IP

File Transfer Protocol (FTP)

PPP

Level of Connectivity

Remote Login (Telnet)

Internet

Wireless/Mobile Communication

GSM

CDMA

WLL

3G

SMS

Voice mail

Application

Electronic Mail

Chat

Video Conferencing

Network Security Concepts:

Cyber Law

Virus Threats and Prevention

Firewall

Cookies

Hacking

Web Related Topics

WebPages

Hyper Text Markup Language (HTML)

eXtensible Markup Language (XML)

Hyper Text Transfer Protocol (HTTP)

Domain Names

URL

Protocol Address

Website

Web browser

Web Servers

Web Hosting.

One Marks Questions: -

What is a Computer Network?

A computer network is an interconnected collection of devices that enables you to store, retrieve, and

share information. Commonly connected devices include personal computers (PCs), minicomputers,

mainframe computers, terminals, workstations, printers, fax machines, pagers, and various data-

storage devices.

What is Data-communication?

74

Data-communication is the combination of data-processing and telecommunication. It includes the

processing of data of program's running on computer-systems, and the communication over great

distance where the information is transported by using of electrical-conductivity, radio-ways, light-

signals, etc.

What is ARPANET?

In 1969, the first computer network was created. Called ARPANET, it interconnected UCLA,

Stanford Research Institute, and UC Santa Barbara in California with the University of Utah. As time

passed, more and more organizations joined this growing computer network.

What is Network Interface Card (NIC)?

The network interface card handles the connection to the network itself through one or more

connectors on the backplane of the card.

What is Hub?

A Hub is a multipurpose network device that lies at the centre of a network to channel the traffic

from one computer to another.

What is Repeater?

A Repeater is a network device that boosts the power of incoming signals to allow the length of a

network to be extended.

What is Bridge?

A Bridge is a network device capable of connecting networks that use similar protocols. It connects

two local area networks running the same network operating system.

Define Router?

A Router is a network device that connects LAN’s, that may be running on different operating

systems, into an inter network and routes traffic between them. The router can have software that

converts on Network Operating System's packets to the other's.

What is Gateway?

A Gateway forwards data between IP networks. It is a machine that acts as an interface between a

small network and a much larger one. Usually, the gateway connects to a high-speed network cable

or medium called the backbone.

75

What is Backbone?

A Backbone is a set of nodes and links connected together comprising a network, or the upper layer

protocols used in a network.

What is Modem?

Modems provide the means to transmit digital computer data over analog transmission media, such

as ordinary, voice-grade telephone lines. The word "modem" is derived from "MOdulate and

DEModulate"—modems convert digital (computer) signals to analog (audio) signals and vice versa.

What is the switching Technique?

Switching Data:

On an inter network, data units must be switched through the various intermediate devices until they

are delivered to their destination. Two contrasting methods of switching data are commonly used

Circuit Switching and Packet Switching.

Define Circuit Switching?

Circuit-switched is a type of network in which a physical path is obtained for and dedicated to a

single connection between two end-points in the network for the duration of the connection.

Ordinary voice phone service is circuit-switched.

Write down the disadvantage of Circuit Switching?

The chief disadvantage of circuit switching is that when communication takes place at less than the

assigned circuit capacity, bandwidth is wasted. Also, communicating devices can’t take advantage of

other, less busy paths through the network unless the circuit is reconfigured.

Write down the advantage of Circuit Switching?

End devices benefit greatly from circuit switching. Since the path is pre-established, data travel

through the network with little processing in transit. And, because multipart messages travel

sequentially through the same path, message segments arrive in an order and little effort is required

to reconstruct the original message.

Important Note: Circuit switching does not necessarily mean that a continuous, physical

pathway exists for the sole use of the circuit. The message stream may be multiplexed with

other message streams in a broadband circuit. In fact, sharing of media is the more likely case

with modern telecommunications. The appearance to the end devices, however, is that the

network has configured a circuit dedicated to their use.

Define Packet Switching?

Packet Switching:

76

Packet-switched describes the type of network in which relatively small units of data called

packets are routed through a network based on the destination address contained within each packet.

Breaking communication down into packets allows the same data path to be shared among many

users in the network. This type of communication between sender and receiver is known as

connectionless (rather than dedicated).

Describe Network Transmission Media?

When data is sent across the network it is converted into electrical signals. To be sent from one

location to another, a signal must travel along a physical path. The physical path that is used to

carry a signal between a signal transmitter and a signal receiver is called the transmission

medium. There are two types of transmission media: guided and unguided.

What is Twisted-Pair Cable?

Twisted-pair wiring refers to a type of cable composed of two (or more) copper wires twisted around

each other within a plastic sheath. The wires are twisted to reduce crosstalk (electrical interference

passing from one wire to the other). There are "shielded" and "unshielded" varieties of twisted-

pair cables.

What is Coaxial Cable?

This type of cable is referred to as "coaxial" because it contains one copper wire (or physical data

channel) that carries the signal and is surrounded by another concentric physical channel consisting

of a wire mesh or foil. The outer channel serves as a ground for electrical interference.

What is difference between thin and thick coaxial cable?

Thinnet is not as flexible as twisted-pair, but it is still used in LAN environments. The

connectors on coaxial cable are called BNC twist-on connectors.

Thicknet is similar to thinnet except that it is larger in diameter. The increase in size

translates into an increase in maximum effective distance. The drawback to the increase in

size, however, is a loss of flexibility.

Define Optical Fiber Cable?

Better known as "fiber optic," are the same types of cable used by most telephone companies for

long-distance service. Optical fiber cable can transmit data over very long distances with little loss

in data integrity.

Write down the advantages of Fiber Optical?

Data is transferred as a pulse of light rather than an electronic pulse, optical fiber is not subject to

electromagnetic interference. The light pulses travel through a glass or plastic wire or fiber encased

in an insulating sheath.

As with thicknet, optical fiber's increased maximum effective distance comes at a price. Optical fiber

is more fragile than wire, difficult to split, and very labor-intensive to install.

77

What is Unguided Media of transmission?

Unguided media are natural parts of the Earth's environment that can be used as physical paths to

carry electrical signals. The atmosphere and outer space are examples of unguided media that are

commonly used to carry signals. These media can carry such electromagnetic signals as microwave,

infrared light waves, and radio waves.

What is Microwave Transmitters?

Microwave transmitters and receivers, especially satellite systems, are commonly used to transmit

network signals over great distances. A microwave transmitter uses the atmosphere or outer

space as the transmission medium to send the signal to a microwave receiver. The microwave

receiver then either relays the signal to another microwave transmitter or translates the signal to

some other form, such as digital impulses, and relays it on another suitable medium to its destination.

Write down the advantage and disadvantage of Microwave transmission?

Advantages:

It is cheaper then the guided media, and require less maintenance.

It provides communication over difficult environment.

It cover large distance.

Disadvantages:

It is unsecured medium of communication.

The loss of signal is more as compared to guided media.

Its communication depend up on the atmospheric conditions.

What is Infrared signal and its uses?

Infrared transmit light waves rather than radio waves, they require a line-of-sight transmission

path.

Infrared are useful for signaling across short distances where it is impractical to lay cable. Because

infrared and laser signals are in the light spectrum therefore, rain, fog, and other environmental

factors can cause transmission problems.

What is LAN?

Local Area Networks (LAN) is a number of devices (Computers, Printers, Fax) that are connected

to each other by some form of wiring, within a localized area (within building e.g. a school, an

office etc. ) to share data and resources. A LAN enables independent devices to communicate

directly with each other through direct communications.

There are three characteristics of LAN’s that must always be considered:

• The transmission medium (the type of cabling used as the link).

78

• The transmission technique (the technique used to handle transmission on the medium).

• The access control method (which decides how a machine accesses the medium).

What is WAN?

Wide Area Networks (WAN) is a number of local area networks that are connected to form a large,

logical network without any geographical limitation. WAN’s can be close together physically or

separated by a large distance. WAN’s can share a large numbers of resources, or they can have

different big network.

What is MAN?

In a Metropolitan Area Network computer connected to each other with in a city to have the

organization concentric needs. Though the distance between the devices is not very large, they can

have their own cabling plan.

What is Network Topologies?

The term "network topology" refers to the layout of a network. Due to the specific nature of

computer network technology, networks must be arranged in a particular way in order to work

properly. These arrangements are based on the network hardware's capabilities and the

characteristics of the various modes of data transfer.

What is Bus Topology and its advantage?

The simplest form of a physical bus topology consists of a trunk (main) cable with only two end

points. When the trunk cable is installed, it is run from area to area and device to device—close

enough to each device so that all devices can be connected to it with short drop cables and T-

connectors.

The principal advantage of this topology is cost: no hubs are required, and shorter lengths

of cable can be used. It is also easy to expand. This simple "one wire, two ends" physical bus

topology is illustrated in Figure 10.

Figure 10: Physical bus topology

79

What is Star Topology?

The simplest form of the physical star topology consists of multiple cables—one for each network

device—attached to a single, central connection device. 10Base-T Ethernet networks, for example,

are based on a physical star topology: each network device is attached to a 10Base-T hub by means

of twisted-pair cable.

What is Ring Topology?

80

It is a closed network structure in the form of a circle, to which all nodes are connected. The ring

name comes from the design of the central network device, which has a loop inside it to which are

attached cables for all the devices on the network..

What is Tree Topology?

Also called a "hierarchical" or "star of stars" topology, tree topology is a combination of bus and star

topologies. Nodes are connected in groups of star-configured workstations that branch out from a

single "root". The root node usually controls the network and sometimes network traffic flow.

What is Mesh Topology?

In a full mesh topology, each node is physically connected to every other node. Partial mesh

topology uses fewer connections, and though less expensive is also less fault-tolerant. In a hybrid

mesh the mesh is complete in some places but partial in others.

The primary advantage of this topology is that it is highly fault tolerant: when one node fails,

traffic can easily be diverted to other nodes. It is also not especially vulnerable to bottlenecks.

81

Define the term bandwidth? Give the unit of bandwidth.

Bandwidth means the capacity of a medium to transmit a signal. It is the bandwidth that determines

the amount of information that can be transmitted for a distance. To carry digital signals, baseband

modulation is used that allows transmission at a signal frequency at a time. To carry Radio

Frequency signals, broadband modulation is used that allows multiple transmission taking place at

different frequencies. Unit of bandwidth is Hertz.

What is a protocol?

A protocol means the set of rules that are applicable for a network for the transmission of data and

signals. Protocols define standardized formats for data packets, techniques for detecting and

correcting errors and so on. E.g. HTP, FTP, PPP etc.

What are cookies?

Cookies are messages that a web server transmits to a web browser so that the web server can keep

track of the user’s activity on a specific web site.

What is web hosting? What are its various categories?

Web hosting mean hosting of web-server applications on a computer system through which

electronic content on the Internet is readily available to any web browser client.

What is Cyberlaw?

In internet, the communication technology uses the means of transferring textual messages, pictures

and many more. Each time there may be number of threats on either from senders or receivers side

which creates a bridge between networking communication.

82

These predefined rules are called cyber law or law of Internet.

What is the firewall ?what are the different firewall techniques?

The system designed to prevent unauthorized access to or fro a private network is called Firewall.

There are several types of firewall techniques:

(i) Packet Filter : Looks as each packet entering or leaving the network and accepts or

rejects it based on user-defined rules.

(ii) Application gateway : Applies security mechanisms to specific applications, such as

FTP and Telnet servers.

(iii) Circuit-level gateway : Apply security mechanisms when a connection is established.

(iv) Proxy server : Intercepts all messages entering and leaving the network. The proxy

server effectively hides the true network addresses.

Write Differentiate between GSM and CDMA ?

GSM(Global System for Mobile) communications is a technique that uses narrowband

TDMA, which allows eight simultaneous calls on the same radio frequency. TDMA is short for Time

Division Multiple Access.

CDMA(Code-division Multiple Access) on the other hand, unlike GSM, does not assign a

static frequency to each user. CDMA uses spread spectrum technique where every channel uses full

available spectrum . With CDMA, data is sent in small pieces over a number of discrete frequencies

available for use at any time in specified range..

Define the following :

(a) Data channel (f) Cookies

(b) Baud (g) Crackers

(c) Mbps (h) Hackers

(d) bps (i) Modem

(e) Web server

(a) Data channel : It is the medium used to carry information or data from one point to another.

(b) Baud : It is the measurement for the information carrying capacity of a communication

channel. It is synonymous with bps(bits per second).

(c) Mbps : Mega bits/Bytes per second. It refers to million thousand bits or bytes transmitted

per second.

(d) bps : bits per second. It refers to thousand bits transmitted per second.

83

(e) Web server : It is a WWW(World Wide Network) server that responds to requests made

by web browser.

(f) Cookies : Cookies are messages that a web server transmits to a web browser so that the web

server can keep track of the user’s activity on a specific web site.

(g) Crackers : These are malicious programmers who break into secure systems .

(h) Hackers : These are more interested in gaining knowledge about computer systems and

possibly using this knowledge for playful pranks.

(i) Modem : It is Modulator-demodulator which modulates & demodulates the signals to & fro.

(2) Expand the following terms:

(a) XML (f) HTML (k) EDGE

(b) GSM (g) WLL (l) WLL

(c) SMS (h) DHTML (m) SLIP

(d) CDMA (i) HTTP (n) PPP

(e) URL (j) TCP/IP (o) RJ-45

Ans.

(a) Extensible Markup Language

(b) Global System for Mobile

(c) Short Message Service

(d) Code Division Multiple Access

(e) Uniform Resource Locator

(f) Hypertext Markup Language

(g) Wireless Local Loop

(h) Dynamic Hypertext Markup Language

(i) Hypertext Transfer Protocol

(j) Transfer Control Protocol- Internet Protocol

(k) Enhanced Data rate for Global Evolution

(l) Wireless in Local Loop

(m) Serial Line Interrupt Protocol

(n) Point to Point Protocol

(o) Registered Jack – 45.

84

Five key areas for network managers to focus on, as recommended by ISO:

1. Fault management

2. Configuration management

3. Performance management

4. Accounting management

5. Security management

For Good Network Design: 80/20 Rule

The 80/20 rule is actually used as guideline when segmenting LAN 80% of the traffic of should

remain on the local LAN, while 20% of the traffic should exit the LAN i.e. toward Backbone .

But with the needs of the users having to access to servers outside of the LAN. The 80/20 rule

has gradually changed into a 20/80 rule where 80% of the traffic has to exit the LAN and 20% of

the network traffic remains in the local LAN. That means instead of upgrading the network

device, it may easier to change the following:

Moving Resource to contain traffic locally

Moving users

Adding server

Conventional Rules:

Using repeater is the 5-4-3 Rule. the maximum path between two station on the network

should not be more than 5 segment with 4 repeaters between those segments and no more

than 3 populated segments.

Bridge is used to repeat the signal but in between the specific route.

Hub share bandwidth with all the devices i.e. it make the communication channel of the

entire terminal busy with its broadcast signal.

4 Marks Question Case Study

1. A company in Reliance has 4 wings of buildings as shown in the diagram:

W1

W3 W4

W2

85

Center to center distances between various Buildings:

W3 to W1 50m

W1 to W2 60m

W2 to W4 25m

W4 to W3 170m

W3 to W2 125m

W1 to w4 90m

Number of computers in each of the wing:

W1 135

W2 25

W3 20

W4 25

Computers in each wing are networked but wings are not networked. The company has now decided

to connect the wings also.

i) Suggest a most suitable cable layout of the connection between the wings.

(ii) The company wants internet accessibility in all the wings. Suggest an economic technology .

(iii) Suggest the placement of the following devices with justification if the company wants

minimized network traffic :

1) Repeater (2) Hub (3) Switch (4) Bridge

iv) The company is planning to link its head office situated in India with the offices at Britain.

Suggest a way to connect it; the company may compromise with the speed of connectivity. Justify

your answer.

Ans:

i) The cable layout will be

W1

W3 W4

W2

86

ii) The topology will be star. Because the distance from W1 to other Places is average, whereas in

ring and tree we will require more cabling.

iii) Hub in W1,W2, W3 and W4 , everyone and Switch in W1 to communicate with other network.

iii) They can connect with either satellite link, or through internet.

2. Indian Industries has the following four buildings in Chennai. Distance between various

wings are given below:

Wing II1 to Wing II 3 70m

Wing II1 to Wing II 2 20m

Wing II 1 to Wing II 4 115m

Wing II 3 to Wing II 4 30m

Wing II 2 to Wing II3 25m

Number of Computers

Wing II 1 35

Wing II 2 25

Wing II 3 80

Wing II 4 60

i. Suggest suitable CABLE LAYOUTS FOR THESE BUILDINGS. (1)

ii. Name the wing where the Server is to be installed. Justify your answer. (1)

iii. Suggest the placement of Hub/Switch in the network. (1)

iv. Mention an economic technology to provide Internet accessibility to all wings. (1)

Ans :

(i) Suitable cable layout is

30m

25m 20m

II1

II 4 II 2

II 3

II 4 II 2

87

(ii) As the 80 – 20 rule, th server should be placed in the building with maximum number of

computers. Thus, we suggest that the server should be placed in Wing II 3.

(iii)

(iv) Dial – up Network

Broad Band

Cable(Twisted paid or Fiber optical or Coaxial cable)

ISDN

Radio Wave

4. Indian Public School in Darjeeling is setting up the network between its different

wings. There are 4 wings named as SENIORS(S), JUNIOR(J), ADMIN(A) and

HOSTEL(H).

Distance between various wings are given below:

Wing A to Wing S 100 m

II1 II 3

30m

25m 20m

II1

II 4 II 2

II 3

Hub/switc

h

Hub/switc

h

Hub/switc

h

Hub/switc

h

88

Wing A to Wing J 200 m

Wing A to Wing H 400 m

Wing S to Wing J 300 m

Wing S to Wing H 100 m

Wing J to Wing H 450 m

Number of computers

Wing A 10

Wing S 200

Wing J 100

Wing H 50

(a) Suggest a suitable Topology for networking the computer of all wings

(b) Name the wing where the server is to be installed. Justify your answer

(c) Suggest the placement of Hub/Switch in the network.

(d) Mention an economic technology to provide internet accessibility to all wings.

Ans. (a) Star or Bus or any other valid topology or diagram.

(b) Wing S, because maximum number of computers are located at Wing A.

(c) Hub/switch in all the wings.

(d) Coaxial cable/Modem/LAN/TCP-IP/Dialup/DSl/Leased lines or any other valid

technology.

5. The Great Brain Organization has set up its new Branch at Sri-Nagar for its

office and web based activities. It has 4 Wings of buildings as shown in the diagram:

89

Number of computers

Wing X 50

Wing Z 130

Wing Y 40

Wing U 15

(a) Suggest a most suitable cable layout of connections between the wings & topology.

(b) Suggest a most suitable place(ie. Wing) to house the server of this organization with a

suitable reason with justification.

(c) Suggest the placement of the following devices with justification :

(i) Repeater (ii) Hub/ Switch

(d) The organization is planning to link its head office situated in Delhi with the offices at

Mizoram. Suggest an economic way to connect it. The company is ready to

compromise on the speed of connectivity. Justify your answer.

Ans. (a) Bus topology

(b) Wing Y as it has the most number of computers thus cabling cost will be reduced and

most traffic will be local.

(c) (i) Repeater is used if the distances are more than 70m. It regenerate data & voice

signals.

(ii) Hub/Switch is better to place in nearby buildings. The maximum distance

covered by an active hub is about 2000ft.

(d) An economic way of connecting is dial-up or broadband as it can connect two

computers at an economic rate through it provides lesser speed than other expensive

methods.

90

POINTS TO REMEMBER:

A network is a collection of interlinked computer by mean of communication system.

InterSpace is the future technology of future.

Two type of switching technologies circuit and packet switching is used for

transmitting data.

Twisted pair, coaxial cable, optical fiber are communally used transmission media.

On the basis of geographical condition networks can be classified into LAN, WAN

and MAN.

The most popular topologies are star, ring, tree and mesh.

RJ45 is an eight wire connector, which I communally used to connect computer on

LAN.

3G (Third Generation) mobile communications technology is a broadband, packet-

based transmission of text, digitized voice, video and multimedia.

Remote login (Telnet) is the process of accessing a network from a remote place

without actually being at the actual place of working.

The crackers are malicious programmers who break into secure system whereas

hackers are more interested in gaining knowledge about computer system.