Vous êtes sur la page 1sur 129

Introduction to Programming

Methodology


Notes
by
Sushma Jaiswal
Assistant Professor, CSIT
Guru Ghasidas Vishwavidyalaya, Bilaspur (C.G.)





To all my loving students













Preface
I am glad to present this notes, especially designed to serve the needs of
the students of Bsc First Semester semester Computer Science. The notes
have been written keeping in mind the general weakness in
understanding the fundamental concepts of the topics. The notes are
self-explanatory and adopt the Teach Yourself style. It is also based
on question-answer pattern. The language of notes is quite easy and
understandable based on scientific approach.
Thanks to the online readers for their overwhelming response to our
previous notes of computer graphics, software engineering, software
testing & programming based numerical methods. The feedback and the
response we received, encouraged me to write to this notes.
Any further improvement in the contents of the notes by making
corrections, omission and inclusion is keen to be achieved based on
suggestions from the readers for which the author shall be obliged.
I acknowledge special thanks to all who involve directly and
indirectly, which are the backbones and main concept provider and
also have been constant source of motivation throughout this
endeavour. They played an active role in coordinating the various
stages of this endeavour and spearheaded the collecting work.
I look forward to receiving valuable suggestions from professors of
various educational institutions, other faculty members and my loving
students for improvement of the quality of the notes. The reader may
feel free to send in their comments and suggestions to the under
mentioned address.

Sushma Jaiswal
Email-Id jaiswal1302@gmail.com

PROGRAM AND PROGRAMMING

PROGRAM PROGRAM PROGRAM PROGRAM

A computer program is a series of organized instructions that directs a computer to perform tasks.
Without programs, computers are useless. A program is like a recipe. It contains a list of variables (called
ingredients) and a list of statements (called directions) that tell the computer what to do with the
variables.

PROGRAMMING PROGRAMMING PROGRAMMING PROGRAMMING

Programming is a creation of a set of commands or instructions which directs a computer in carrying out
a task.

PROGRAMMING LANGUAGE PROGRAMMING LANGUAGE PROGRAMMING LANGUAGE PROGRAMMING LANGUAGE

A programming language is a set of words, symbols and codes that enables humans to communicate with
computers.
Examples of programming languages are:
BASIC (Beginners All Purpose Symbolic Instruction Code) , Pascal, C , Smalltalk.

GENERATIONS OF PROGRAMMING LANGUAGE GENERATIONS OF PROGRAMMING LANGUAGE GENERATIONS OF PROGRAMMING LANGUAGE GENERATIONS OF PROGRAMMING LANGUAGE

A low-level programming language is a programming language that provides little or no abstraction
from computers microprocessor.

A high-level programming language is a programming language that is more abstract, easier to use, and
more portable across platforms.

LEVELS OF PROGRAMMING LANGUAGE LEVELS OF PROGRAMMING LANGUAGE LEVELS OF PROGRAMMING LANGUAGE LEVELS OF PROGRAMMING LANGUAGE

First Generation Programming Language(1GL) First Generation Programming Language(1GL) First Generation Programming Language(1GL) First Generation Programming Language(1GL)
Second Generation Programming Language(2GL) Second Generation Programming Language(2GL) Second Generation Programming Language(2GL) Second Generation Programming Language(2GL)
Third Generation Programming Language(3GL) Third Generation Programming Language(3GL) Third Generation Programming Language(3GL) Third Generation Programming Language(3GL)
Fourth Generation Programming Language(4GL) Fourth Generation Programming Language(4GL) Fourth Generation Programming Language(4GL) Fourth Generation Programming Language(4GL)
Fifth Generation Programming Fifth Generation Programming Fifth Generation Programming Fifth Generation Programming Language(5GL) Language(5GL) Language(5GL) Language(5GL)



FIRST GENERATION OF PROGRAMMING LANGUAGE FIRST GENERATION OF PROGRAMMING LANGUAGE FIRST GENERATION OF PROGRAMMING LANGUAGE FIRST GENERATION OF PROGRAMMING LANGUAGE
The first generation of programming language, or 1GL, is machine language. Machine language is a set of
instructions and data that a computer's central processing unit can execute directly. Machine language
statements are written in binary code, and each statement corresponds to one machine action.


SECOND GENERATION PROGRAMMING LANGUAGE SECOND GENERATION PROGRAMMING LANGUAGE SECOND GENERATION PROGRAMMING LANGUAGE SECOND GENERATION PROGRAMMING LANGUAGE
The second generation programming language, or 2GL, is assembly language. Assembly language is the
human-readable notation for the machine language used to control specific computer operations. An
assembly language programmer writes instructions using symbolic instruction codes that are meaningful
abbreviations or mnemonics. An assembler is a program that translates assembly language into machine
language.


THIRD GENERATION PROGRAMMING LANGUAGE THIRD GENERATION PROGRAMMING LANGUAGE THIRD GENERATION PROGRAMMING LANGUAGE THIRD GENERATION PROGRAMMING LANGUAGE
The third generation of programming language, 3GL, or procedural language uses a series of English-like
words that are closer to human language, to write instructions.
High-level programming languages make complex programming simpler and easier to read, write and
maintain. Programs written in a high-level programming language must be translated into machine
language by a compiler or interpreter. PASCAL, FORTRAN, BASIC, COBOL, C and C++ are examples of
third generation programming languages.
FOURTH GENERATION PROGRAMMING LANGUAGE FOURTH GENERATION PROGRAMMING LANGUAGE FOURTH GENERATION PROGRAMMING LANGUAGE FOURTH GENERATION PROGRAMMING LANGUAGE
The fourth generation programming language or non-procedural language, often abbreviated as 4GL,
enables users to access data in a database. A very high-level programming language is often referred to as
goal-oriented programming language because it is usually limited to a very specific application and it
might use syntax that is never used in other programming languages. SQL, NOMAD and FOCUS are
examples of fourth generation programming languages.

FIFTH GENERATION PROGRAMMING LANGUAGE FIFTH GENERATION PROGRAMMING LANGUAGE FIFTH GENERATION PROGRAMMING LANGUAGE FIFTH GENERATION PROGRAMMING LANGUAGE
The fifth generation programming language or visual programming language is also known as natural
language. Provides a visual or graphical interface, called a visual programming environment, for creating
source codes. Fifth generation programming allows people to interact with computers without needing
any specialized knowledge. People can talk to computers and the voice recognition systems can convert
spoken sounds into written words. Prolog and Mercury are the best known fifth-generation languages.


Q. EXPLAIN PROGRAM DEVELOPMENT PHASES ? Q. EXPLAIN PROGRAM DEVELOPMENT PHASES ? Q. EXPLAIN PROGRAM DEVELOPMENT PHASES ? Q. EXPLAIN PROGRAM DEVELOPMENT PHASES ?
Ans. Ans. Ans. Ans.
OVERVIEW OF PROGRAM DEVELOPMENT PHASES OVERVIEW OF PROGRAM DEVELOPMENT PHASES OVERVIEW OF PROGRAM DEVELOPMENT PHASES OVERVIEW OF PROGRAM DEVELOPMENT PHASES
In program development, there are five main phases. These phases are a series of steps that programmers
undertake to build computer programs. The program development phases guide computer programmers through
the development of a program.
The five main phases of program development are as follows:
PROBLEM ANALYSIS PHASE PROBLEM ANALYSIS PHASE PROBLEM ANALYSIS PHASE PROBLEM ANALYSIS PHASE
During the problem analysis phase, the programmer will interview the client to find out what the clients
needs are.

PROGRAM DESIGN PHASE PROGRAM DESIGN PHASE PROGRAM DESIGN PHASE PROGRAM DESIGN PHASE
Based on that, the programmer will design a flow chart that represents the needs of the client, which in
this case is the school registration program.

CODING PHASE CODING PHASE CODING PHASE CODING PHASE
Once the flow chart is confirmed, the programmer will perform coding.

TESTING AND DEBUGGING PHASE TESTING AND DEBUGGING PHASE TESTING AND DEBUGGING PHASE TESTING AND DEBUGGING PHASE
The school registration program will be tested by the users at the clients site. In this case, it will be the
school office administrators. If there are any errors, the programmer will do a debugging of the program.
Once the programmer has finished the coding, the next step is to test it. The purpose of program testing is
to ensure the program runs correctly and is error-free. There are three types of errors uncovered during
this phase: syntax errors, logic errors and run-time errors.


SYNTAX ERROR SYNTAX ERROR SYNTAX ERROR SYNTAX ERROR
When the code violates the syntax of the programming language, a syntax error occurs.
A syntax error is caused by a wrong spelling in command and declaration. Other syntax errors
include case sensitive, punctuation and wrong word command.
When syntax error is located, a message is displayed on the screen.
LOGIC ERROR LOGIC ERROR LOGIC ERROR LOGIC ERROR
If the expected output and actual output do not match for any set of data, the program has a
logic error. A logic error is an error in the design that causes inaccurate outputs.
RUN RUN RUN RUN- -- -TIME TIME TIME TIME ERROR ERROR ERROR ERROR
Run-time error is an error that occurs while the program is running or executing. A run-time
error may cause the program to stop running.

DEBUGGING DEBUGGING DEBUGGING DEBUGGING

The process of locating and correcting of syntax and logic errors in a program is known as debugging the
program. The program errors themselves are called bugs. Thus removing the errors are called debugging.


DOCUMENTATION PHASE DOCUMENTATION PHASE DOCUMENTATION PHASE DOCUMENTATION PHASE
After this, the programmer will complete the documentation for the program; this includes the user
manual, a clear layout of the input and output records and a program listing. In program development,
documentation refers to the written material generated throughout all the phases of program
development. All documentation must be ready by the end of program development.

INTERNAL DOCUMENTATION INTERNAL DOCUMENTATION INTERNAL DOCUMENTATION INTERNAL DOCUMENTATION
Internal documentation consists of comments within the program. These two types of comments are
global comments and internal comments.


Q. Write important characteristics of good programming language? Q. Write important characteristics of good programming language? Q. Write important characteristics of good programming language? Q. Write important characteristics of good programming language?
Ans. Ans. Ans. Ans.

Characteristics of a Characteristics of a Characteristics of a Characteristics of a good programming Language good programming Language good programming Language good programming Language

The popularity of any programming language depends upon the useful features that it provides
to its users. A large number of programming languages are in existence around the world but not all of
them are popular.
The following are some of the important characteristics of a good programming language:

The language must allow the programmer to write simple, clear and concise programs.
The language must be simple to use so that a program can learn it without any explicit training.
The language must be platform independent, i.e. the programs developed using the programming
language can run on any computer system.
The graphical user interface (GUI) of the language must be attractive, user-friendly and self explanatory.
The language must be consistent in terms of both syntax and semantics.
The program should also be well documented so that later the author or any other programmer can
understand the program.
LESSON
FLOWCHARTING
1. INTRODUCTION
The flowchart is a means of visually presenting the flow of data through an information
processing systems, the operations performed within the system and the sequence in which they
are performed. In this lesson, we shall concern ourselves with the program flowchart, which
describes what operations (and in what sequence) are required to solve a given problem. The
program flowchart can be likened to the blueprint of a building. As we know a designer draws a
blueprint before starting construction on a building. Similarly, a programmer prefers to draw a
flowchart prior to writing a computer program. As in the case of the drawing of a blueprint, the
flowchart is drawn according to defined rules and using standard flowchart symbols prescribed
by the American National Standard Institute, Inc.

2. OBJECTIVES
At the end of this lesson, you will be able to understand:
The meaning of flowchart
The basic parts of the flowchart such as flowchart symbols and the flow lines
connecting these symbols.
The advantages and limitations of flowchart

3. MEANING OF A FLOWCHART
A flowchart is a diagrammatic representation that illustrates the sequence of operations to be
performed to get the solution of a problem. Flowcharts are generally drawn in the early stages of
formulating computer solutions. Flowcharts facilitate communication between programmers and
business people. These flowcharts play a vital role in the programming of a problem and are
quite helpful in understanding the logic of complicated and lengthy problems. Once the
flowchart is drawn, it becomes easy to write the program in any high level language. Often we
see how flowcharts are helpful in explaining the program to others. Hence, it is correct to say
that a flowchart is a must for the better documentation of a complex program.
4 GUIDELINES FOR DRAWING A FLOWCHART
Flowcharts are usually drawn using some standard symbols; however, some special symbols can
also be developed when required. Some standard symbols, which are frequently, required for
flowcharting many computer programs are shown in Fig. 1
Start or end of the program

Computational steps or processing function of a program

Input or output operation

Decision making and branching

Connector or joining of two parts of program

Magnetic Tape

Magnetic Disk

Off-page connector

Flow line

Annotation

Display

Fig. 1 Flowchart Symbols

The following are some guidelines in flowcharting:
(a) In drawing a proper flowchart, all necessary requirements should be listed out in
logical order.
(b) The flowchart should be clear, neat and easy to follow. There should not be any room
for ambiguity in understanding the flowchart.
(c) The usual direction of the flow of a procedure or system is from left to right or top to
bottom.
(d) Only one flow line should come out from a process symbol.

or

(e) Only one flow line should enter a decision symbol, but two or three flow lines, one
for each possible answer, should leave the decision symbol.


Yes < 0 > 0


No = 0


(f) Only one flow line is used in conjunction with terminal symbol.





(g) Write within standard symbols briefly. As necessary, you can use the annotation
symbol to describe data or computational steps more clearly.

This is top secret data

(h) If the flowchart becomes complex, it is better to use connector symbols to reduce the
number of flow lines. Avoid the intersection of flow lines if you want to make it more
effective and better way of communication.
(i) Ensure that the flowchart has a logical start and finish.
(j) It is useful to test the validity of the flowchart by passing through it with a simple test
data.

5. ADVANTAGES OF USING FLOWCHARTS
The benefits of flowcharts are as follows:
1. Communication: Flowcharts are better way of communicating the logic of a system to all
concerned.
2. Effective analysis: With the help of flowchart, problem can be analysed in more effective
way.
3. Proper documentation: Program flowcharts serve as a good program documentation, which
is needed for various purposes.
4. Efficient Coding: The flowcharts act as a guide or blueprint during the systems analysis and
program development phase.
5. Proper Debugging: The flowchart helps in debugging process.
6. Efficient Program Maintenance: The maintenance of operating program becomes easy
with the help of flowchart. It helps the programmer to put efforts more efficiently on that
part

6 LIMITATIONS OF USING FLOWCHARTS
1. Complex logic: Sometimes, the program logic is quite complicated. In that case, flowchart
becomes complex and clumsy.
2. Alterations and Modifications: If alterations are required the flowchart may require re-
drawing completely.
3. Reproduction: As the flowchart symbols cannot be typed, reproduction of flowchart becomes
a problem.
4. The essentials of what is done can easily be lost in the technical details of how it is done.

7. FEW EXAMPLES ON FLOWCHARTING
Now we shall present few examples on flowcharting for proper understanding of this technique.
This will help in student in program development process at a later stage.
Example 1
Draw a flowchart to find the sum of first 50 natural numbers.
Answer: The required flowchart is given in Fig.2.









START
SUM = 0
N = 0
N = N + 1



NO

YES





Fig.2 Sum of first 50 natural numbers

Fig 2 Flowchart for computing the sum of first 50 natural numbers.
Example 2
Draw a flowchart to find the largest of three numbers A,B, and C.
Answer: The required flowchart is shown in Fig 3






YES NO YES YES

NO NO





Fig.3 Flowchart for finding out the largest of three numbers
Example 3
START
SUM = SUM + N
IS N=50?
PRINT SUM
END
READ A, B, C
IS
B>C?
IS
A>B?
IS
A>C?
PRINT B
PRINT C PRINT C PRINT A
END
Draw a flowchart for computing factorial N (N!)
Where N! = 1 2 3 N .
The required flowchart has been shown in fig.4
Answer:









NO


YES




Fig.4 Flowchart for computing factorial N
Example 4
The current year and the year in which the employee joined the organization are entered through the
keyboard. If the number of years for which the employee has served the organization is greater than 3
then a bonus of Rs. 2500/- is given to the employee. If the years of service are not greater than 3,
then the program should do nothing.

START
READ N
M = 1
F = 1
F = F * M
IS
M=N?
PRINT F
END
M=M+1



Example 5
In a company an employee is paid as under:
If his basic salary is less than Rs. 1500, then HRA = 10% of basic salary and DA = 90% of basic
salary. If his salary is either equal to or above Rs. 1500, then HRA = Rs. 500 and DA = 98% of basic
salary. If the employee's salary is input through the keyboard draw a flowchart to find his gross
salary.




Example 5
The marks obtained by a student in 5 different subjects are input through the keyboard. The student
gets a division as per the following rules:
Percentage above or equal to 60 - First division
Percentage between 50 and 59 - Second division
Percentage between 40 and 49 - Third division
Percentage less than 40 - Fail
Draw a flowchart to calculate the division obtained by the student.
9
Example 6
A companys salesmen are selling toothpaste and tooth powder. The company having 50
salesmen gives 10% commission on the sale of toothpaste and 20% commission on tooth
powder.
Draw a flowchart to compute and print the total sale and the total commission for each
salesman.

Answer: The required flowchart is shown in Fig.5
Note:
S = Salesman number
P1 = Amount of sales of paste
P2 = Amount of sales of powder
K = Counter for the number of salesman
























Fig 5: Flowchart for Computing Commission on Different Items

10
Example 7
Modify the flowchart in Example 4 to print the following heading.
Salesman No Total Sale Total commission
Under these heading, write the values of these variables for the 50 salesmen. At the end, the
totals of the entire sale and the entire commission should also be printed out.
Answer: The required flowchart is shown in Fig 6
Note:
TS = Total sales
TC = Total commission

























Fig:.6 Flowchart for writing proper heading and its contents


11

IN-TEXT QUESTION
1. What are name and the use of the following symbols?
(a) (b) (c) (d) (e)

2. Define Flowcharting.


QUESTIONS
1. Draw a flowchart to read a number N and print all its divisors.
2. Draw a flowchart for computing the sum of the digits of any given number
3. Draw a flowchart to find the sum of given N numbers.
4. Draw a flowchart to computer the sum of squares of integers from 1 to 50
5. Draw a flowchart to arrange the given data in an ascending order.

Algorithm Algorithm Algorithm Algorithm
Algorithm is an ordered sequence of finite, well defined, unambiguous instructions for completing a
task. Algorithm is an English-like representation of the logic which is used to solve the problem. It is a
step-by-step procedure for solving a task or a problem. The steps must be ordered, unambiguous and
finite in number.
For accomplishing a particular task, different algorithms can be written. The different algorithms differ
in their requirements of time and space. The programmer selects the best-suited algorithm for the given
task to be solved.
Lets now look at simple algorithm to find the greatest among three numbers, as follows:
Algorithm Algorithm Algorithm Algorithm- -- -
Step 1: Start
Step 2: read the three numbers A,B,C.
Step 3: Compare A and B. if A is greater perform step 4 else perform step 5.
Step 4: Compare A and C. if A is greater, output A is greatest else output C is greatest perform step 6.
Step 5: Compare B and C. If B is greater, output B is greatest else output C is greatest.
Step 6: Stop.








Question Question Question Question- -- -Exp Exp Exp Explain Basic Concepts of Object lain Basic Concepts of Object lain Basic Concepts of Object lain Basic Concepts of Object- -- -Oriented Programming Oriented Programming Oriented Programming Oriented Programming
Ans.
Basic Concepts of Object-Oriented Programming
Objects
Classes
Data abstraction and encapsulation
Inheritance
Polymorphism
Dynamic binding
Message passing
We shall discuss these concepts in some detail in this section.
Objects Objects Objects Objects
Objects are the basic run time entities in an object oriented system. They may represent a person, a
place, a bank account, a table of data or any item that the program has to handle.
They may also represent user-defined data such as vectors, time and lists. Programming problem is
analyzed in terms of objects and the nature of communication between them. Program objects should be
chosen such that they match closely with the real world objects. Objects take up space in the memory
and have an associated address like a record in PASCAL or a structure in C.
When a program is executed, the objects interact by sending messages to one another. For example, if
customer and account are two objects in a program, then the customer objects may send a message
to the account object requesting for the bank balance. Each object contains data, and the code to
manipulate the data. Objects can interact without having to know details of each others data or code. it
is sufficient to know the type of massage accepted, and the type of response returned by the objects.
Although different authors represent them differently. Fig. shows two notations that are popularly used
in object oriented analysis and design.


Classe Classe Classe Classes ss s
We just mentioned that objects contain data, and code to manipulate that data. The entire set of data
and code of an object can be made a user-defined data type with the help of a class. In fact, objects are
variables of the type class. Once a class has been defined, we can create any number of objects
belonging to that class. Each object is associated with the data of type class with which they are created.
A class is thus a collection of objects of similar type. For example, mango, apple and orange are
members of the class fruit. Classes are user-defined data types and behaves like the built-in types of a
programming language. The syntax used to create an object is no different than the syntax used to
create an integer object in C. if fruit has been defined as a class, then the statement
Fruit mango;
Will create an object mango belonging to the class fruit.
Data abstraction encapsulation Data abstraction encapsulation Data abstraction encapsulation Data abstraction encapsulation
The wrapping up of data and functions into a single unit (called class) is known as encapsulation. data
encapsulation is the most striking feature of a class.
Abstraction refers to the act of representing essential features without including the background details
or explanations. Classes use the concepts of abstraction and are defined as list of abstract attributes such
as size, weight and cost, and functions to operate on these attributes.

Inheritance Inheritance Inheritance Inheritance
Inheritance is the process by which objects of one class acquire the properties of objects of another
class. It supports the concept of hierarchical classification. For example, the bird robin is a part of the
class flying bird which is again a part of the class bird. The principle behind this sort of division is
that each derived class shares common characteristics with the class from which it is derived as
illustrated in fig.

Polymorphism Polymorphism Polymorphism Polymorphism
Polymorphism is another important OOP concept. Polymorphism, a Greek term, means the ability to
take more than one form. An operation may exhibit different behaviors in different instances. The
behavior depends upon the types of data used in the operation. For example, consider the operation of
addition. For two numbers, the operation will generate a sum.


Dynamic Binding Dynamic Binding Dynamic Binding Dynamic Binding
Binding refers to the linking of a procedure call to the code to be executed in response to the call.
Dynamic binding (also known as late binding) means that the code associated with a given procedure
call is not known until the time of the call at run time. It is associated with polymorphism and
inheritance.
Consider the procedure draw in fig. by inheritance every object will have this procedure.
Message passing Message passing Message passing Message passing
An object oriented program consists of a set of objects that communicate with each other. The process of
programming in an object-oriented language, therefore, involves the following basic steps:
1. Creating classes that define objects and their behavior.
2. Creating objects from class definitions, and
3. Establishing communication among objects.



Decision Table Decision Table Decision Table Decision Table
A decision table is a graphical method for explaining the logic of making decision in tabular
format.
It is a set of conditions + set of actions and different combinations of decisions.
It is a matrix representation of logic of decisions which specify the possible conditions for
decision and resulting actions.

The decision table is divided into two parts:
1. Condition
2. Action

1. 1. 1. 1. Condition: Condition: Condition: Condition:
The condition part specifies all conditions that are applied to the inputted data. It is also divided
into two parts
i. Condition Stub:-It describes the conditions that exist in the program logic.
ii. Condition Entry:-It provides answers to questions asked in the condition asked in the
condition term.

2. 2. 2. 2. Actio Actio Actio Action: n: n: n:
The action part is subdivided into two parts
i. Action Stub:-It describes the action to be taken to meet each condition.
ii. Action Entry:-It describes the appropriate action resulting from the answer to the
condition in condition entry.
Format:
Table Heading Table Heading Table Heading Table Heading Decision Rule Decision Rule Decision Rule Decision Rule
Condition Stub Condition Stub Condition Stub Condition Stub Condition Entry
Action Stub Action Stub Action Stub Action Stub Action Entry
Advantages of Decision Table Advantages of Decision Table Advantages of Decision Table Advantages of Decision Table
1. It provides compact representation of decision making process.
2. It is easier to understand particular path.
3. It can be changed according to situation.
4. These are best suited for calculating discounts, commissions or inventory control
procedures.
5. The structure of decision table promotes a logically complete and consistent
problem definition.

Disadvantages of Decision Table Disadvantages of Decision Table Disadvantages of Decision Table Disadvantages of Decision Table
1. It cannot express the complete sequence of operations to solve a problem therefore
it may be difficult for the programmer to translate decision table into program.
2. If there are too many alternatives, it is difficult to list in decision table.
3. It does not show the flow of logic for the solution to a given problem.

Q: An insurance company uses the following rule to determine the eligibility of a driver for
insurance.
The driver will be insured if:-
1. The driver lives in the city with population less than 5000 and he is married man.
2. The driver lives in the city with population less than 5000 and he is married and age is
over 30 years old.
3. The driver lives in the city with population is 5000 or more and it is married female.
4. The driver is male over 30.
5. The driver is married and under 30.


Q: Study following conditions and draw a decision table:-
1. If product code=A
And customer type=1
And the order amount<=700
Then 5% discount allowed
2. If product code=A
And customer type=2
And the order amount<=700
Then 7.5% discount allowed
3. If product code=A
And customer type=1
And the order amount>=700
Then 7.5% discount allowed
4. If product code=A
And customer type=2
And the order amount>700
Condition Condition Condition Condition Rule1 Rule1 Rule1 Rule1 Rule2 Rule2 Rule2 Rule2 Rule3 Rule3 Rule3 Rule3 Rule4 Rule4 Rule4 Rule4 Rule5 Rule5 Rule5 Rule5 Else Else Else Else
Lives in city Lives in city Lives in city Lives in city
population<5000 population<5000 population<5000 population<5000
Y Y N - - -
Male Male Male Male Y - N Y - -
Married Married Married Married Y Y Y - Y -
Age>30 Age>30 Age>30 Age>30 - Y - Y N -
Action Action Action Action Rule1 Rule1 Rule1 Rule1 Rule2 Rule2 Rule2 Rule2 Rule3 Rule3 Rule3 Rule3 Rule4 Rule4 Rule4 Rule4 Rule5 Rule5 Rule5 Rule5 Else Else Else Else
Insured Insured Insured Insured Y Y Y Y Y
Uninsured Uninsured Uninsured Uninsured Y
Then 10% discount allowed
5. A flat discount of 5% on product code=B regardless of customer type and the order amount

















Q: Draw a decision table for a company with three person A,B,C whose share in the company
are 50%,20%,30% sequentially. Any low arises in the company will be passed if it is supported
by share holders and whose share holding exceed 2/3 of the total shares.

Condition Condition Condition Condition Rule1 Rule1 Rule1 Rule1 Rule2 Rule2 Rule2 Rule2 Else Else Else Else
A 50% A 50% A 50% A 50% Y Y -
B 20% B 20% B 20% B 20% N Y -
C 30% C 30% C 30% C 30% Y N -
Action Action Action Action Rule1 Rule1 Rule1 Rule1 Rule2 Rule2 Rule2 Rule2 Else Else Else Else
Condition Condition Condition Condition Rule1 Rule1 Rule1 Rule1 Rule2 Rule2 Rule2 Rule2 Rule3 Rule3 Rule3 Rule3 Rule4 Rule4 Rule4 Rule4 Rule5 Rule5 Rule5 Rule5 Else Else Else Else
Product Product Product Product
code=A code=A code=A code=A
Y Y Y Y N -
Customer Customer Customer Customer
type=1 type=1 type=1 type=1
Y N Y N - -
Order Order Order Order
amount<=700 amount<=700 amount<=700 amount<=700
Y Y N N - -
Action Action Action Action Rule1 Rule1 Rule1 Rule1 Rule2 Rule2 Rule2 Rule2 Rule3 Rule3 Rule3 Rule3 Rule4 Rule4 Rule4 Rule4 Rule5 Rule5 Rule5 Rule5 Else Else Else Else
Discount 5% Discount 5% Discount 5% Discount 5% Y Y
Discount Discount Discount Discount
7.5% 7.5% 7.5% 7.5%
Y Y
Discount 10% Discount 10% Discount 10% Discount 10% Y
No Discount No Discount No Discount No Discount Y
Low Passed Low Passed Low Passed Low Passed Y Y
Low Rejected Low Rejected Low Rejected Low Rejected N


Q: A Co-operating bank xyz granted loan under following conditions draw decision table and
tree-
1. If a customer has a account with the bank and has no loan outstanding (no dues), loan will
be granted.
2. If a customer has an account is outstanding from previous loan, loan will be granted if
special management approval is obtained.
3. Reject loan application in all other cases.
Condition Condition Condition Condition Rule1 Rule1 Rule1 Rule1 Rule2 Rule2 Rule2 Rule2 Else Else Else Else
Customer has Account Customer has Account Customer has Account Customer has Account Y Y -
No Out No Out No Out No Out- -- -standing loan standing loan standing loan standing loan
amount amount amount amount
Y N -
Special Management Special Management Special Management Special Management
Approval Approval Approval Approval
- Y -
Action Action Action Action Rule1 Rule1 Rule1 Rule1 Rule2 Rule2 Rule2 Rule2 Else Else Else Else
Loan Application Accept Loan Application Accept Loan Application Accept Loan Application Accept Y Y
Loan Application Reject Loan Application Reject Loan Application Reject Loan Application Reject Y

Pseudocode Pseudocode Pseudocode Pseudocode
Pseudocode is a method of designing a program using normal human-language (an English
language) statements to describe the logic and processing flow.
OR OR OR OR
Pseudocode is a program analysis tool that is used for planning the logic of a program."Pseudo"
means imitation or false and "code" refers to the instructions coded in a programming
language. So it is an imitation of the actual computer instructions.
These Pseudocode instructions are phrases written in one of the ordinary natural language
(e.g., English, German, French etc.) it is also known as Program Design Language (PDL) as the
main emphasis is on the design of the program. The structure of the Pseudocode resembles with
the computer instructions and no symbols are used like flowcharts in it.
The following basic logic structures are sufficient for writing any computer program and the
Pseudocode is composed of all these"
1. Sequence
2. Selection (IF...THEN or IF...THEN...ELSE)
3. Loop or Iteration (DO...WHILE or DO/REPEAT...UNTIL)

1. Sequence 1. Sequence 1. Sequence 1. Sequence
Sequence logic is used when all the instructions are followed one by one in the order in which
these are written. The Pseudocode instructions are written in the sequence in which these are
to be executed in the program. In Pseudocode the flow of logic is from top to bottom. The
Pseudocode for the sequence structure is depicted below"

............ ............ ............ ............
............ ............ ............ ............
.......... .......... .......... ............ .. .. ..
Procedure Procedure Procedure Procedure- -- -1 11 1
Procedure Procedure Procedure Procedure- -- -2 22 2
Procedure Procedure Procedure Procedure- -- -3 33 3
............ ............ ............ ............
............ ............ ............ ............
............ ............ ............ ............
(Pseudocode for sequence structure)

Figure-Sequence Control Structure

2. 2. 2. 2. Selection (IF...THEN or IF...THEN...ELSE) Selection (IF...THEN or IF...THEN...ELSE) Selection (IF...THEN or IF...THEN...ELSE) Selection (IF...THEN or IF...THEN...ELSE)
Selection logic or decision logic is used for making decisions using simple or compound
conditions. it is used for selecting one proper path out of the two or more alternative paths at
our disposal in the program logic. It is depicted in one of the two following forms"

IF....THEN
IF....THEN....ELSE

Pseudocode for IF...THEN...ELSE Pseudocode for IF...THEN...ELSE Pseudocode for IF...THEN...ELSE Pseudocode for IF...THEN...ELSE
.....
.....
IF CONDITION THEN
Procedure-1
Procedure-2
Procedure-3
ELSE
Procedure-4
Procedure-5
Procedure-6
ENDIF
.....
.....

Figure-Nested IF..THEN..ELSE instruction
Here, if the CONDITION is true then the following procedures are performed: Procedure-1,
Procedure-2, Procedure-3 else the Procedure-4, Procedure-5, Procedure-6 are performed.

Pseudocode for IF....THEN Pseudocode for IF....THEN Pseudocode for IF....THEN Pseudocode for IF....THEN
......
......
IF CONDITION THEN
Procedure-1
Procedure-2
Procedure-3
ENDIF
.......
.......
Here, if the ONDITION is true then Procedure-1, Procedure-2, Procedure-3 are performed
otherwise the instructions written after ENDIF are performed without performing any of these
procedures. The instructions will also be followed after ENDIF when the condition is true but
after performing the three procedures. ENDIF indicates the end of the decision structure.

Figure-Flow chart for Decision Parameters
For example,a candidate can get only one position; either 1st Division, 2nd, 3rd or Fail; not all
together. we can see this example showing the use of selection.



3. 3. 3. 3. Loop or iteration Loop or iteration Loop or iteration Loop or iteration
Iteration logic is used when the instructions are to be executed many times depending on some
condition(s). The two structures used for it are:
DO.....WHILE
DO/REPEAT.....UNTIL

the looping control structure executes a statements a number of times depending on the value
of the Boolean expression, Figure shows two types of looping structures:\
In C++ language, WHILE, DO...WHILE, for and nested loops can be used to implement looping.
Looping is also known as Repetition or Iteration.
After refinement of a subtask we can get something that can be realized as an iterative
construct. it can be easily implemented if we are aware of the basic structure of all loops.
To construct any loop we must take into account three things:
(1) The initial condition that needs to apply before the loop starts to execute.
(2) The invariant relation that must apply after each iteration of the loop.
(3) The condition under which the iterative process must terminate.
With some loops it cannot be directly determined in advance how many iterations there will be
before the loop will terminate. in fact there is no guarantee that loops of this type will
terminate rests with the algorithm designer.
Every problem must terminate in a finite number of steps, so it is the duty of the algorithm
designer to set up the termination of a loop (if exist inside a problem). For example, by forcing
the condition under which the loop will continue to iterate to become false.
Advantages of Pseudocode Advantages of Pseudocode Advantages of Pseudocode Advantages of Pseudocode
There are three main advantages of Pseudocode are:
1. The conversion of a Pseudocode to a program (in any programming language) is much
easier than a flow chart or a decision table.
2. Pseudocode is much easier to modify (when required) as compared to a flowchart.
3. Less time and effort is involved while a Pseudocode in comparison to draw a flowchart.
A programmer can concentrate more on the logic of the program because only fewer
rules are to be followed in writing Pseudocode than writing a program in any computer
language.
L LL Limitations imitations imitations imitations of Pseudocode of Pseudocode of Pseudocode of Pseudocode
The limitations of Pseudocodes are:
1. For a beginner, it is easier to draw a flowchart to follow the logic of the program in
comparison to write the Pseudocode for it.
2. A graphical representation of the program logic is not available. When we write
Pseudocode.
3. No standard rules are available in using Pseudocodes. So, communication problems
exist due to lack of standardization as different programmers follow different styles.

Operating System Operating System Operating System Operating System Overview Overview Overview Overview
This chapter gives a basic idea about Operating System starting with definition of operating
system, and its functions.

A AA An operating System (OS) is an intermediary between users and computer hardware. It
provides users an environment in which a user can execute programs conveniently and
efficiently.
In technical terms, it is software which manages hardware. An operating System controls the
allocation of resources and services such as memory, processors, devices and information.

Definition Definition Definition Definition
An operating system is a program that acts as an interface between the user and the computer
hardware and controls the execution of all kinds of programs.

Following are some of important functions of an operating System.
Memory Management
Processor Management
Device Management
File Management
Security
Control over system performance
Job accounting
Error detecting aids
Coordination between other software and users

Memory Management Memory Management Memory Management Memory Management
Memory management refers to management of Primary Memory or Main Memory. Main
memory is a large array of words or bytes where each word or byte has its own address.
Main memory provides a fast storage that can be access directly by the CPU. So for a program
to be executed, it must in the main memory. Operating System does the following activities for
memory management.
Keeps tracks of primary memory i.e. what part of it are in use by whom, what part are
not in use.
In multiprogramming, OS decides which process will get memory when and how
much.
Allocates the memory when the process requests it to do so.
De-allocates the memory when the process no longer needs it or has been terminated.

Processor Management Processor Management Processor Management Processor Management
In multiprogramming environment, OS decides which process gets the processor when and
how much time. This function is called process scheduling. Operating System does the
following activities for processor management.
Keeps tracks of processor and status of process. Program responsible for this task is
known as traffic controller.
Allocates the processor (CPU) to a process.
De-allocates processor when processor is no longer required.

Device Management Device Management Device Management Device Management
OS manages device communication via their respective drivers. Operating System does the
following activities for device management.
Keeps tracks of all devices. Program responsible for this task is known as the I/O
controller.
Decides which process gets the device when and for how much time.
Allocates the device in the efficient way.
De-allocates devices.

File Management File Management File Management File Management
A file system is normally organized into directories for easy navigation and usage. These
directories may contain files and other directions. Operating System does the following
activities for file management.
Keeps track of information, location, uses, status etc. The collective facilities are often
known as file system.
Decides who gets the resources.
Allocates the resources.
De-allocates the resources.

Other Important Activities Other Important Activities Other Important Activities Other Important Activities
Following are some of the important activities that Operating System does.
Security Security Security Security -- By means of password and similar other techniques, preventing
unauthorized access to programs and data.
Control over system performance Control over system performance Control over system performance Control over system performance -- Recording delays between request for a service and
response from the system.
Job accounting Job accounting Job accounting Job accounting -- Keeping track of time and resources used by various jobs and users.
Error detecting aids Error detecting aids Error detecting aids Error detecting aids -- Production of dumps, traces, error messages and other
debugging and error detecting aids.
Coordination between other software and users Coordination between other software and users Coordination between other software and users Coordination between other software and users -- Coordination and assignment of
compilers, interpreters, assemblers and other software to the various users of the
computer systems.






Types Types Types Types of Operating System of Operating System of Operating System of Operating System
Operating systems are there from the very first computer generation. Operating systems keep
evolving over the period of time. Following are few of the important types of operating system
which are most commonly used.
Batch operating sy Batch operating sy Batch operating sy Batch operating system stem stem stem
The users of batch operating system do not interact with the computer directly. Each user
prepares his job on an off-line device like punch cards and submits it to the computer operator.
To speed up processing, jobs with similar needs are batched together and run as a group. Thus,
the programmers left their programs with the operator. The operator then sorts programs into
batches with similar requirements.
The problems with Batch Systems are following.
Lack of interaction between the user and job.
CPU is often idle, because the speeds of the mechanical I/O devices are slower than CPU.
Difficult to provide the desired priority.

Time Time Time Time- -- -sharing operating systems sharing operating systems sharing operating systems sharing operating systems
Time sharing is a technique which enables many people, located at various terminals, to use a
particular computer system at the same time. Time-sharing or multitasking is a logical
extension of multiprogramming. Processor's time which is shared among multiple users
simultaneously is termed as time-sharing. The main difference between Multiprogrammed
Batch Systems and Time-Sharing Systems is that in case of Multiprogrammed batch systems,
objective is to maximize processor use, whereas in Time-Sharing Systems objective is to
minimize response time.
Multiple jobs are executed by the CPU by switching between them, but the switches occur so
frequently. Thus, the user can receive an immediate response. For example, in a transaction
processing, processor execute each user program in a short burst or quantum of computation.
That is if n users are present, each user can get time quantum. When the user submits the
command, the response time is in few seconds at most.
Operating system uses CPU scheduling and multiprogramming to provide each user with a
small portion of a time. Computer systems that were designed primarily as batch systems have
been modified to time-sharing systems.

Advantages of Timesharing operating systems are following:
Provide advantage of quick response.
Avoids duplication of software.
Reduces CPU idle time.

Disadvantages of Timesharing operating systems are following.
Problem of reliability.
Question of security and integrity of user programs and data.
Problem of data communication.


Distributed operating System Distributed operating System Distributed operating System Distributed operating System
Distributed systems use multiple central processors to serve multiple real time application and
multiple users. Data processing jobs are distributed among the processors accordingly to which
one can perform each job most efficiently.
The processors communicate with one another through various communication lines (such as
high-speed buses or telephone lines). These are referred as loosely coupled systems or
distributed systems. Processors in a distributed system may vary in size and function. These
processors are referred as sites, nodes, and computers and so on.

The advantages of distributed systems are following.
With resource sharing facility user at one site may be able to use the resources available
at another.
Speedup the exchange of data with one another via electronic mail.
If one site fails in a distributed system, the remaining sites can potentially continue
operating.
Better service to the customers.
Reduction of the load on the host computer.
Reduction of delays in data processing.

Network operating System Network operating System Network operating System Network operating System
Network Operating System runs on a server and provides server the capability to manage data,
users, groups, security, applications, and other networking functions. The primary purpose of
the network operating system is to allow shared file and printer access among multiple
computers in a network, typically a local area network (LAN), a private network or to other
networks. Examples of network operating systems are Microsoft Windows Server 2003,
Microsoft Windows Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, and BSD.
The advantages of network operating systems are following.
Centralized servers are highly stable.
Security is server managed.
Upgrades to new technologies and hardware can be easily integrated into the system.
Remote access to servers is possible from different locations and types of systems.

The disadvantages of network operating systems are following.
High cost of buying and running a server.
Dependency on a central location for most operations.
Regular maintenance and updates are required.

Real Time operating System Real Time operating System Real Time operating System Real Time operating System
Real time system is defines as a data processing system in which the time interval required to
process and respond to inputs is so small that it controls the environment. Real time processing
is always on line whereas on line system need not be real time. The time taken by the system to
respond to an input and display of required updated information is termed as response time. So
in this method response time is very less as compared to the online processing.
Real-time systems are used when there are rigid time requirements on the operation of a
processor or the flow of data and real-time systems can be used as a control device in a
dedicated application. Real-time operating system has well-defined, fixed time constraints
otherwise system will fail. For example Scientific experiments, medical imaging systems,
industrial control systems, weapon systems, robots, and home-appliance controllers, Air traffic
control system etc.
There are two types of real-time operating systems.
Hard real Hard real Hard real Hard real- -- -time systems time systems time systems time systems
Hard real-time systems guarantee that critical tasks complete on time. In hard real-time
systems secondary storage is limited or missing with data stored in ROM. In these
systems virtual memory is almost never found.
Soft real Soft real Soft real Soft real- -- -time systems time systems time systems time systems
Soft real time systems are less restrictive. Critical real-time task gets priority over other
tasks and retains the priority until it completes. Soft real-time systems have limited
utility than hard real-time systems. For example, Multimedia, virtual reality, Advanced
Scientific Projects like undersea exploration and planetary rovers etc.

O OO Operating System Services perating System Services perating System Services perating System Services
An Operating System provides services to both the users and to the programs.
It provides programs, an environment to execute.
It provides users, services to execute the programs in a convenient manner.

Following are few common services provided by operating systems.
Program execution
I/O operations
File System manipulation
Communication
Error Detection
Resource Allocation
Protection

Program execution Program execution Program execution Program execution
Operating system handles many kinds of activities from user programs to system programs like
printer spooler, name servers, file server etc. Each of these activities is encapsulated as a
process.
A process includes the complete execution context (code to execute, data to manipulate,
registers, OS resources in use). Following are the major activities of an operating system with
respect to program management.
Loads a program into memory.
Executes the program.
Handles program's execution.
Provides a mechanism for process synchronization.
Provides a mechanism for process communication.
Provides a mechanism for deadlock handling.

I/O Operation I/O Operation I/O Operation I/O Operation
I/O subsystem comprised of I/O devices and their corresponding driver software. Drivers hides
the peculiarities of specific hardware devices from the user as the device driver knows the
peculiarities of the specific device.
Operating System manages the communication between user and device drivers. Following are
the major activities of an operating system with respect to I/O Operation.
I/O operation means read or write operation with any file or any specific I/O device.
Program may require any I/O device while running.
Operating system provides the access to the required I/O device when required.

File system manipulation File system manipulation File system manipulation File system manipulation
A file represents a collection of related information. Computer can store files on the disk
(secondary storage), for long term storage purpose. Few examples of storage media are
magnetic tape, magnetic disk and optical disk drives like CD, DVD. Each of these media has its
own properties like speed, capacity, and data transfer rate and data access methods.
A file system is normally organized into directories for easy navigation and usage. These
directories may contain files and other directions. Following are the major activities of an
operating system with respect to file management.
Program needs to read a file or write a file.
The operating system gives the permission to the program for operation on file.
Permission varies from read-only, read-write, denied and so on.
Operating System provides an interface to the user to create/delete files.
Operating System provides an interface to the user to create/delete directories.
Operating System provides an interface to create the backup of file system.

Communication Communication Communication Communication
In case of distributed systems which are a collection of processors that do not share memory,
peripheral devices, or a clock, operating system manages communications between processes.
Multiple processes with one another through communication lines in the network.
OS handles routing and connection strategies, and the problems of contention and security.
Following are the major activities of an operating system with respect to communication.
Two processes often require data to be transferred between them.
The both processes can be on the one computer or on different computer but are
connected through computer network.
Communication may be implemented by two methods either by Shared Memory or by
Message Passing.

Error handling Error handling Error handling Error handling
Error can occur anytime and anywhere. Error may occur in CPU, in I/O devices or in the
memory hardware. Following are the major activities of an operating system with respect to
error handling.
OS constantly remains aware of possible errors.
OS takes the appropriate action to ensure correct and consistent computing.

Resource Management Resource Management Resource Management Resource Management
In case of multi-user or multi-tasking environment, resources such as main memory, CPU
cycles and files storage are to be allocated to each user or job. Following are the major activities
of an operating system with respect to resource management.
OS manages all kind of resources using schedulers.
CPU scheduling algorithms are used for better utilization of CPU.

Protection Protection Protection Protection
Considering computer systems having multiple users the concurrent execution of multiple
processes, then the various processes must be protected from each another's activities.
Protection refers to mechanism or a way to control the access of programs, processes, or users
to the resources defined by computer systems. Following are the major activities of an
operating system with respect to protection.
OS ensures that all access to system resources is controlled.
OS ensures that external I/O devices are protected from invalid access attempts.
OS provides authentication feature for each user by means of a password.







Operating Operating Operating Operating System Properties System Properties System Properties System Properties
Following are few of very important tasks that Operating System handles.
Batch processing Batch processing Batch processing Batch processing
Batch processing is a technique in which Operating System collects one programs and data
together in a batch before processing starts. Operating system does the following activities
related to batch processing.
OS defines a job which has predefined sequence of commands, programs and data as a
single unit.
OS keeps a number a job in memory and executes them without any manual
information.
Jobs are processed in the order of submission i.e. first come first served fashion.
When job completes its execution, its memory is released and the output for the job gets
copied into an output spool for later printing or processing.


Advantages Advantages Advantages Advantages
Batch processing takes much of the work of the operator to the computer.
Increased performance as a new job gets started as soon as the previous job finished
without any manual intervention.
Disadvantages Disadvantages Disadvantages Disadvantages
Difficult to debug program.
A job could enter an infinite loop. Due to lack of protection scheme, one batch job can
affect pending jobs. Multitasking

Multitasking Multitasking Multitasking Multitasking
Multitasking refers to term where multiple jobs are executed by the CPU simultaneously by
switching between them. Switches occur so frequently that the users may interact with each
program while it is running. Operating system does the following activities related to
multitasking.
The user gives instructions to the operating system or to a program directly, and
receives an immediate response.
Operating System handles multitasking in the way that it can handle multiple
operations / executes multiple programs at a time.
Multitasking Operating Systems are also known as Time-sharing systems.
These Operating Systems were developed to provide interactive use of a computer
system at a reasonable cost.
A time-shared operating system uses concept of CPU scheduling and
multiprogramming to provide each user with a small portion of a time-shared CPU.
Each user has at least one separate program in memory.


A program that is loaded into memory and is executing is commonly referred to as a
process.
When a process executes, it typically executes for only a very short time before it either
finishes or needs to perform I/O.
Since interactive I/O typically runs at people speeds, it may take a long time to complete.
During this time a CPU can be utilized by another process.
Operating system allows the users to share the computer simultaneously. Since each
action or command in a time-shared system tends to be short, only a little CPU time is
needed for each user.
As the system switches CPU rapidly from one user/program to the next, each user is
given the impression that he/she has his/her own CPU, whereas actually one CPU is
being shared among many users.

Multiprogramming Multiprogramming Multiprogramming Multiprogramming
When two or more programs are residing in memory at the same time, then sharing the
processor is referred to the multiprogramming. Multiprogramming assumes a single shared
processor. Multiprogramming increases CPU utilization by organizing jobs so that the CPU
always has one to execute.
Following figure shows the memory layout for a multiprogramming system.

Operating system does the following activities related to multiprogramming.

The operating system keeps several jobs in memory at a time.
This set of jobs is a subset of the jobs kept in the job pool.
The operating system picks and begins to execute one of the job in the memory.
Multiprogramming operating system monitors the state of all active programs and
system resources using memory management programs to ensures that the CPU is never
idle unless there are no jobs

Advantages Advantages Advantages Advantages
High and efficient CPU utilization.
User feels that many programs are allotted CPU almost simultaneously.

Disadvantages Disadvantages Disadvantages Disadvantages
CPU scheduling is required.
To accommodate many jobs in memory, memory management is required.

Interactivity Interactivity Interactivity Interactivity
Interactivity refers that a User is capable to interact with computer system. Operating system
does the following activities related to interactivity.
OS provides user an interface to interact with system.
OS managers input devices to take inputs from the user. For example, keyboard.
OS manages output devices to show outputs to the user. For example, Monitor.
OS Response time needs to be short since the user submits and waits for the result.

Real Time System Real Time System Real Time System Real Time System
Real time systems represents are usually dedicated embedded systems. Operating system does
the following activities related to real time system activity.
In such systems, Operating Systems typically read from and react to sensor data.
The Operating system must guarantee response to events within fixed periods of time to
ensure correct performance.

Distributed Environment Distributed Environment Distributed Environment Distributed Environment
Distributed environment refers to multiple independent CPUs or processors in a computer
system. Operating system does the following activities related to distributed environment.
OS Distributes computation logics among several physical processors.
The processors do not share memory or a clock.
Instead, each processor has its own local memory.
OS manages the communications between the processors. They communicate with each
other through various communication lines.

Spooling Spooling Spooling Spooling
Spooling is an acronym for simultaneous peripheral operations on line. Spooling refers to
putting data of various I/O jobs in a buffer. This buffer is a special area in memory or hard disk
which is accessible to I/O devices. Operating system does the following activities related to
distributed environment.
OS handles I/O device data spooling as devices have different data access rates.
OS maintains the spooling buffer which provides a waiting station where data can rest
while the slower device catches up.
OS maintains parallel computation because of spooling process as a computer can
perform I/O in parallel fashion. It becomes possible to have the computer read data
from a tape, write data to disk and to write out to a tape printer while it is doing its
computing task.

Advantages
The spooling operation uses a disk as a very large buffer.
Spooling is capable of overlapping I/O operation for one job with processor operations
for another job.











Operating System Types Operating System Types Operating System Types Operating System Types

There are many types of operating systems. The most common is the Microsoft suite of
operating systems. They include from most recent to the oldest:

Windows XP Professional Edition - A version used by many businesses on workstations. It has
the ability to become a member of a corporate domain.

Windows XP Home Edition - A lower cost version of Windows XP which is for home use only
and should not be used at a business.

Windows 2000 - A better version of the Windows NT operating system which works well both
at home and as a workstation at a business. It includes technologies which allow hardware to
be automatically detected and other enhancements over Windows NT.

Windows ME - A upgraded version from windows 98 but it has been historically plagued with
programming errors which may be frustrating for home users.

Windows 98 - This was produced in two main versions. The first Windows 98 version was
plagued with programming errors but the Windows 98 Second Edition which came out later
was much better with many errors resolved.

Windows NT - A version of Windows made specifically for businesses offering better control
over workstation capabilities to help network administrators.

Windows 95 - The first version of Windows after the older Windows 3.x versions offering a
better interface and better library functions for programs.
There are other worthwhile types of operating systems not made by Microsoft. The greatest
problem with these operating systems lies in the fact that not as many application programs are
written for them. However if you can get the type of application programs you are looking for,
one of the systems listed below may be a good choice.

Unix - A system that has been around for many years and it is very stable. It is primary used to
be a server rather than a workstation and should not be used by anyone who does not
understand the system. It can be difficult to learn. Unix must normally run an a computer
made by the same company that produces the software.

Linux - Linux is similar to Unix in operation but it is free. It also should not be used by anyone
who does not understand the system and can be difficult to learn.

Apple MacIntosh - Most recent versions are based on Unix but it has a good graphical
interface so it is both stable (does not crash often or have as many software problems as other
systems may have) and easy to learn. One drawback to this system is that it can only be run on
Apple produced hardware.

Interpreter Interpreter Interpreter Interpreter
The purpose of interpreter is similar to that of a compiler. The interpreter is used to convert the high
level language program into computer under stable form. However the interpreter functions in a
different way than a compiler.
Interpreter performs line-by-line execution of the source code during program execution. Interpreter
reads the source code line-by-line, converts it into machine under stable from, executes the line, and
then proceeds to the next line. Some languages that use an interpreter are BASIC and Python.
Difference between a compiler and An Interpreter: Difference between a compiler and An Interpreter: Difference between a compiler and An Interpreter: Difference between a compiler and An Interpreter:
Compiler and Interpreter are used to convert a program written in high-level language to machine
language; however, they work differently. The key differences between a compiler and an interpreter
are as follows:
Interpreter looks at a source code line-by-line. Compiler looks at the entire source code.
Interpreter converts a line into machine executable form, executes the line, and proceeds with
the next line. Compiler converts the entire source code into object-code and creates the object
code. The object code is then executes by the user.
For a given source code, once it is compiled, the object code is created. This object code can be
executed multiple number of times by the user. However, interpreter executes line-by-line, so
executes the program using an interpreter means that during each execution, the source code is
first interpreted and then executed.
During execution of an object code, the compiler is not required. However, for interpretation,
both interpreter and the source code are required during execution (because source code is
interpreted during execution).
Since interpreter interprets line-by-line, the interpreted code runs slower than the compiled
code.
L LL Linker inker inker inker
Linker is a program that links several object modules and libraries to a single executable
program. A source code of a program is often very large consisting of several hundred or more
lines. the source code may also include reference to libraries. All these independent modules
may not be stored in a single object file. The code is broken down into many independent
modules for easy debugging and maintenance. Before execution of the program, these modules
and the required libraries are linked together using the linker software. The compiled and the
linked program are called the executable code.
Loader Loader Loader Loader
The loader software is used to load and reload the executable program in the main memory.
Software has to be loaded into the main memory during execution. Loader assigns storage space
to the program in the main memory for execution.

ALL ALL ALL ALL
COMMANDS COMMANDS COMMANDS COMMANDS
IN IN IN IN
MS DOS MS DOS MS DOS MS DOS

C CC Compiled ompiled ompiled ompiled by by by by- -- -Ms. Sushma Jaiswal Ms. Sushma Jaiswal Ms. Sushma Jaiswal Ms. Sushma Jaiswal
Assistant Prof.CSIT,GGV,Bilaspur(C.G.) Assistant Prof.CSIT,GGV,Bilaspur(C.G.) Assistant Prof.CSIT,GGV,Bilaspur(C.G.) Assistant Prof.CSIT,GGV,Bilaspur(C.G.)



In the crowd of all advanced Operating Systems, very simple In the crowd of all advanced Operating Systems, very simple In the crowd of all advanced Operating Systems, very simple In the crowd of all advanced Operating Systems, very simple
and powerful operating system DOS is loosing its presence. and powerful operating system DOS is loosing its presence. and powerful operating system DOS is loosing its presence. and powerful operating system DOS is loosing its presence.
This booklet is merely collection of DOS commands. All This booklet is merely collection of DOS commands. All This booklet is merely collection of DOS commands. All This booklet is merely collection of DOS commands. All
information in information in information in information in this this this this booklet booklet booklet booklet is copyrighted stuff by M is copyrighted stuff by M is copyrighted stuff by M is copyrighted stuff by Microsoft icrosoft icrosoft icrosoft & & & &
others others others others. I . I . I . I had had had had just recompiled just recompiled just recompiled just recompiled these commands these commands these commands these commands for ease of use for ease of use for ease of use for ease of use
(Collected these commands years ago, when I started learning (Collected these commands years ago, when I started learning (Collected these commands years ago, when I started learning (Collected these commands years ago, when I started learning
computers) computers) computers) computers). Do visit Microsoft site for detailed info about MS . Do visit Microsoft site for detailed info about MS . Do visit Microsoft site for detailed info about MS . Do visit Microsoft site for detailed info about MS
DOS. DOS. DOS. DOS. This booklet really helped me a lot. This booklet really helped me a lot. This booklet really helped me a lot. This booklet really helped me a lot. Hope you will Hope you will Hope you will Hope you will also also also also
find this booklet useful. find this booklet useful. find this booklet useful. find this booklet useful.



THIS BOOKLET CONTAIN ALL REGULARLY USED COMMANDS IN MS DOS WITH THEIR HELP

*************** IMPORTANT *******************
* TO GET HELP ABOUT ANY COMMAND IN DOS *
* TYPE THE COMMAND AND "/?" AND PRESS ENTER *
* FOR EXAMPLE *
* DIR /? *
*********************************************
1. DIR COMMAND

Displays a list of files and subdirectories in a directory.

DIR [drive:][path][filename] [/P] [/W] [/A[[:]attributes]]
[/O[[:]sortorder]] [/S] [/B] [/L] [/V] [/4]

[drive:][path][filename]
Specifies drive, directory, and/or files to list.
(Could be enhanced file specification or multiple filespecs.)
/P Pauses after each screenful of information.
/W Uses wide list format.
/A Displays files with specified attributes.
attributes D Directories R Read-only files
H Hidden files A Files ready for archiving
S System files - Prefix meaning not
/O List by files in sorted order.
sortorder N By name (alphabetic) S By size (smallest first)
E By extension (alphabetic) D By date & time (earliest
first)
G Group directories first - Prefix to reverse order
A By Last Access Date (earliest first)
/S Displays files in specified directory and all subdirectories.
/B Uses bare format (no heading information or summary).
/L Uses lowercase.
/V Verbose mode.
/4 Displays year with 4 digits (ignored if /V also given).

Switches may be preset in the DIRCMD environment variable. Override
preset switches by prefixing any switch with - (hyphen)--for example, /-W.


2. CLS COMMAND

Clears the screen.

3. CD COMMAND

Displays the name of or changes the current directory.

CHDIR [drive:][path]
CHDIR[..]
CD [drive:][path]
CD[..]

.. Specifies that you want to change to the parent directory.

Type CD drive: to display the current directory in the specified drive.
Type CD without parameters to display the current drive and directory.

4. MD
Creates a directory.

MKDIR [drive:]path
MD [drive:]path

5. RD
Removes (deletes) a directory.

RMDIR [drive:]path
RD [drive:]path

6. COPY
Copies one or more files to another location.

COPY [/A | /B] source [/A | /B] [+ source [/A | /B] [+ ...]] [destination
[/A | /B]] [/V] [/Y | /-Y]

source Specifies the file or files to be copied.
/A Indicates an ASCII text file.
/B Indicates a binary file.
destination Specifies the directory and/or filename for the new file(s).
/V Verifies that new files are written correctly.
/Y Suppresses prompting to confirm you want to overwrite an
existing destination file.
/-Y Causes prompting to confirm you want to overwrite an
existing destination file.

The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line

To append files, specify a single file for destination, but multiple files
for source (using wildcards or file1+file2+file3 format).


7. XCOPY
Copies files and directory trees.

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/W]
[/C] [/I] [/Q] [/F] [/L] [/H] [/R] [/T] [/U]
[/K] [/N]

source Specifies the file(s) to copy.
destination Specifies the location and/or name of new files.
/A Copies files with the archive attribute set,
doesn't change the attribute.
/M Copies files with the archive attribute set,
turns off the archive attribute.
/D:date Copies files changed on or after the specified date.
If no date is given, copies only those files whose
source time is newer than the destination time.
/P Prompts you before creating each destination file.
/S Copies directories and subdirectories except empty ones.
/E Copies directories and subdirectories, including empty ones.
Same as /S /E. May be used to modify /T.
/W Prompts you to press a key before copying.
/C Continues copying even if errors occur.
/I If destination does not exist and copying more than one file,
assumes that destination must be a directory.
/Q Does not display file names while copying.
/F Displays full source and destination file names while copying.
/L Displays files that would be copied.
/H Copies hidden and system files also.
/R Overwrites read-only files.
/T Creates directory structure, but does not copy files. Does not
include empty directories or subdirectories. /T /E includes
empty directories and subdirectories.
/U Updates the files that already exist in destination.
/K Copies attributes. Normal Xcopy will reset read-only
attributes.
/Y Overwrites existing files without prompting.
/-Y Prompts you before overwriting existing files.
/N Copy using the generated short names.

8. DEL
Deletes one or more files.

DEL [drive:][path]filename [/P]
ERASE [drive:][path]filename [/P]

[drive:][path]filename Specifies the file(s) to delete. Specify multiple
files by using wildcards.
/P Prompts for confirmation before deleting each file.


9. DATE
Displays or sets the date.

DATE [date]

Type DATE without parameters to display the current date setting and
a prompt for a new one. Press ENTER to keep the same date.

10. VER
Displays the Windows version.

VER
Windows 98 [Version 4.10.1998]

11. TYPE
Displays the contents of text files.

TYPE [drive:][path]filename

12. EDIT

MS-DOS Editor Version 2.0.026 Copyright (c) Microsoft Corp 1995.

EDIT [/B] [/H] [/R] [/S] [/<nnn>] [/?] [file(s)]

/B - Forces monochrome mode.
/H - Displays the maximum number of lines possible for your hardware
/R - Load file(s) in read-only mode.
/S - Forces the use of short filenames.
/<nnn> - Load binary file(s), wrapping lines to <nnn> characters wide.
/? - Displays this help screen.
[file] - Specifies initial files(s) to load. Wildcards and multiple
filespecs can be given.





File Edit Search View Options Help
+------------------------------- C:\WINDOWS\NAME -----------------------------
---+
NAME BILL GATES
_ MICROSOFT CORPORATION
_
_

_

_

_

_

_

_

_

_

_

_

_

_
F1=Help Line:1 Col:1
+-----------------------------------------------------------------------------
--

MENU BAR IN EDIT

I. FILE MENU

File
++----------------+
New
Open...
Save
Save As...
Close
+----------------
Print...
+----------------
Exit
+----------------+

II. EDIT MENU

Edit
+------------------+
Cut Ctrl+X
Copy Ctrl+C
Paste Ctrl+V
Clear Del
+------------------+


III. SEARCH MENU

Search
+-----------------------------+
Find...
Repeat Last Find F3
Replace...
+-----------------------------+

IV. VIEW MENU

View
+------------------------+
Split Window Ctrl+F6
Size Window Ctrl+F8
Close Window Ctrl+F4
+------------------------
1 UNTITLED1 Alt+1
2 DISPLAY.TXT Alt+2
3 ATMREG.ATM Alt+3
4 NAME Alt+4
+------------------------+

V. OPTIONS MENU

Options
+-----------------+
Settings...
Colors...
+-----------------+

VI. HELP MENU

Help
+-------------+
Commands...
About...
+-------------+


13. DOSKEY

Edits command lines, recalls command lines, and creates macros

DOSKEY [/switch ...] [macroname=[text]]

/BUFSIZE:size Sets size of macro and command buffer
(default:512)
/ECHO:on|off Enables/disables echo of macro expansions (default:on)
/FILE:file Specifies file containing a list of macros
/HISTORY Displays all commands stored in memory
/INSERT Inserts new characters into line when typing
/KEYSIZE:size Sets size of keyboard type-ahead buffer (default:15)
/LINE:size Sets maximum size of line edit buffer
(default:128)
/MACROS Displays all DOSKey macros
/OVERSTRIKE Overwrites new characters onto line when typing (default)
/REINSTALL Installs a new copy of DOSKey
macroname Specifies a name for a macro you create
text Specifies commands you want to assign to the macro

UP,DOWN arrows recall commands
Esc clears current command
F7 displays command history
Alt+F7 clears command history
[chars]F8 searches for command beginning with [chars]
F9 selects a command by number
Alt+F10 clears macro definitions

The following are special codes you can use in DOSKey macro definitions:
$T Command separator: allows multiple commands in a macro
$1-$9 Batch parameters: equivalent to %1-%9 in batch programs
$* Symbol replaced by everything following macro name on the command
line

14. WIN

Starts Windows.

WIN [/D:[F][M][S][V][X]]

/D Used for troubleshooting when Windows does not start correctly.
:F Turns off 32-bit disk access.
Equivalent to SYSTEM.INI file setting: 32BitDiskAccess=FALSE.
:M Enables Safe mode.
This is automatically enabled during Safe start (function key F5).
:N Enables Safe mode with networking.
This is automatically enabled during Safe start (function key F6).
:S Specifies that Windows should not use ROM address space between
F000:0000 and 1 MB for a break point.
Equivalent to SYSTEM.INI file setting: SystemROMBreakPoint=FALSE.
:V Specifies that the ROM routine will handle interrupts from the hard
disk controller.
Equivalent to SYSTEM.INI file setting: VirtualHDIRQ=FALSE.
:X Excludes all of the adapter area from the range of memory that Windows
scans to find unused space.
Equivalent to SYSTEM.INI file setting: EMMExclude=A000-FFFF.


16. EXIT
Quits the COMMAND.COM program (command interpreter).

EXIT

17. TIME
Current time is 12:12:46.21a
Enter new time:

18. DELTREE
Deletes a directory and all the subdirectories and files in it.

To delete one or more files and directories:
DELTREE [/Y] [drive:]path [[drive:]path[...]]

/Y Suppresses prompting to confirm you want to delete
the subdirectory.
[drive:]path Specifies the name of the directory you want to delete.

Note: Use DELTREE cautiously. Every file and subdirectory within the
specified directory will be deleted.

19. MOVE

Moves files and renames files and directories.

To move one or more files:
MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination

To rename a directory:
MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2

[drive:][path]filename1 Specifies the location and name of the file
or files you want to move.
destination Specifies the new location of the file. Destination
can consist of a drive letter and colon, a
directory
name, or a combination. If you are moving only one
file, you can also include a filename if you want
to rename the file when you move it.
[drive:][path]dirname1 Specifies the directory you want to rename.
dirname2 Specifies the new name of the directory.

/Y Suppresses prompting to confirm creation of a directory
or overwriting of the destination.
/-Y Causes prompting to confirm creation of a directory or
overwriting of the destination.

The switch /Y may be present in the COPYCMD environment variable.
This may be overridden with /-Y on the command line.


20. ATTRIB

Displays or changes file attributes.

ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [[drive:][path]filename] [/S]

+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.
/S Processes files in all directories in the specified path.


21. SCANDISK

SCAN YOUR DISK FOR ERRORS IN IT AND REMOVES THEM
For information about the command-line parameters supported by
ScanDisk for Windows, look up 'checking for errors, in disks' in
the Windows Help index. Then view the topic 'Checking your disk
for errors every time your computer starts.'

22. COMMAND
Starts a new copy of the Windows Command Interpreter.

COMMAND [[drive:]path] [device] [/E:nnnnn] [/L:nnnn] [/U:nnn] [/P] [/MSG]
[/LOW] [/Y [/[C|K] command]]
[drive:]path Specifies the directory containing COMMAND.COM.
device Specifies the device to use for command input and output.
/E:nnnnn Sets the initial environment size to nnnnn bytes.
(nnnnn should be between 256 and 32,768).
/L:nnnn Specifies internal buffers length (requires /P as well).
(nnnn should be between 128 and 1,024).
/U:nnn Specifies the input buffer length (requires /P as well).
(nnn should be between 128 and 255).
/P Makes the new Command Interpreter permanent (can't exit).
/MSG Stores all error messages in memory (requires /P as well).
/LOW Forces COMMAND to keep its resident data in low memory.
/Y Steps through the batch program specified by /C or /K.
/C command Executes the specified command and returns.
/K command Executes the specified command and continues running.



23. CHOICE

Waits for the user to choose one of a set of choices.

CHOICE [/C[:]choices] [/N] [/S] [/T[:]c,nn] [text]

/C[:]choices Specifies allowable keys. Default is YN
/N Do not display choices and ? at end of prompt string.
/S Treat choice keys as case sensitive.
/T[:]c,nn Default choice to c after nn seconds
text Prompt string to display

ERRORLEVEL is set to offset of key user presses in choices.

24. CHKDSK
Checks a disk and displays a status report.

CHKDSK [drive:][[path]filename] [/F] [/V]

[drive:][path] Specifies the drive and directory to check.
filename Specifies the file(s) to check for fragmentation.
/F Fixes errors on the disk.
/V Displays the full path and name of every file on the disk.

Type CHKDSK without parameters to check the current disk.

Instead of using CHKDSK, try using SCANDISK. SCANDISK can reliably detect
and fix a much wider range of disk problems.

25. DISKCOPY
Copies the contents of one floppy disk to another.

DISKCOPY [drive1: [drive2:]] [/1] [/V] [/M]

/1 Copies only the first side of the disk.
/V Verifies that the information is copied correctly.
/M Force multi-pass copy using memory only.

The two floppy disks must be the same type.
You may specify the same drive for drive1 and drive2.


26. DEBUG
Runs Debug, a program testing and editing tool.

DEBUG [[drive:][path]filename [testfile-parameters]]

[drive:][path]filename Specifies the file you want to test.
testfile-parameters Specifies command-line information required by
the file you want to test.

After Debug starts, type ? to display a list of debugging commands.
-?
assemble A [address]
compare C range address
dump D [range]
enter E address [list]
fill F range list
go G [=address] [addresses]
hex H value1 value2
input I port
load L [address] [drive] [firstsector] [number]
move M range address
name N [pathname] [arglist]
output O port byte
proceed P [=address] [number]
quit Q
register R [register]
search S range list
trace T [=address] [value]
unassemble U [range]
write W [address] [drive] [firstsector] [number]
allocate expanded memory XA [#pages]
deallocate expanded memory XD [handle]
map expanded memory pages XM [Lpage] [Ppage] [handle]
display expanded memory status XS
-


27. FDISK
Configures a hard disk for use with MS-DOS.

FDISK [/STATUS] /X

/STATUS Displays partition information.
/X Ignores extended disk-access support. Use this switch if you
receive disk access or stack overflow messages.


*****************************************************************************
Microsoft Windows 98
Fixed Disk Setup Program
(C)Copyright Microsoft Corp. 1983 - 1998

FDISK Options
Current fixed disk drive: 1

Choose one of the following:

1. Create DOS partition or Logical DOS Drive
2. Set active partition
3. Delete partition or Logical DOS Drive
4. Display partition information
5. Change current fixed disk drive

Enter choice: [1]

Press Esc to exit FDISK
*****************************************************************************
28. FC
Compares two files or sets of files and displays the differences between
them.

FC [/A] [/C] [/L] [/LBn] [/N] [/T] [/W] [/nnnn] [drive1:][path1]filename1
[drive2:][path2]filename2
FC /B [drive1:][path1]filename1 [drive2:][path2]filename2

/A Displays only first and last lines for each set of differences.
/B Performs a binary comparison.
/C Disregards the case of letters.
/L Compares files as ASCII text.
/LBn Sets the maximum consecutive mismatches to the specified number of
lines.
/N Displays the line numbers on an ASCII comparison.
/T Does not expand tabs to spaces.
/W Compresses white space (tabs and spaces) for comparison.
/nnnn Specifies the number of consecutive lines that must match after a
mismatch.
29. FIND
Searches for a text string in a file or files.

FIND [/V] [/C] [/N] [/I] "string" [[drive:][path]filename[ ...]]

/V Displays all lines NOT containing the specified string.
/C Displays only the count of lines containing the string.
/N Displays line numbers with the displayed lines.
/I Ignores the case of characters when searching for the string.
"string" Specifies the text string to find.
[drive:][path]filename
Specifies a file or files to search.

If a pathname is not specified, FIND searches the text typed at the prompt
or piped from another command.
29. FORMAT
Formats a disk for use with MS-DOS.

FORMAT drive: [/V[:label]] [/Q] [/F:size] [/B | /S] [/C]
FORMAT drive: [/V[:label]] [/Q] [/T:tracks /N:sectors] [/B | /S] [/C]
FORMAT drive: [/V[:label]] [/Q] [/1] [/4] [/B | /S] [/C]
FORMAT drive: [/Q] [/1] [/4] [/8] [/B | /S] [/C]

/V[:label] Specifies the volume label.
/Q Performs a quick format.
/F:size Specifies the size of the floppy disk to format (such
as 160, 180, 320, 360, 720, 1.2, 1.44, 2.88).
/B Allocates space on the formatted disk for system files.
/S Copies system files to the formatted disk.
/T:tracks Specifies the number of tracks per disk side.
/N:sectors Specifies the number of sectors per track.
/1 Formats a single side of a floppy disk.
/4 Formats a 5.25-inch 360K floppy disk in a high-density drive.
/8 Formats eight sectors per track.
/C Tests clusters that are currently marked "bad."

30. START
Runs a Windows program or an MS-DOS program.

START [options] program [arg...]
START [options] document.ext

/m[inimized] Run the new program minimized (in the background).
/max[imized] Run the new program maximized (in the foreground).
/r[estored] Run the new program restored (in the foreground). [default]
/w[ait] Does not return until the other program exits.

31. LABEL
Creates, changes, or deletes the volume label of a disk.

LABEL [drive:][label]

C:\WINDOWS>LABEL
Volume in drive C is HDD-A-1-SRD
Volume Serial Number is 397F-15E1
Volume label (11 characters, ENTER for none)?

32. SYS
Copies MS-DOS system files and command interpreter to a disk you specify.

SYS [drive1:][path] drive2:

[drive1:][path] Specifies the location of the system files.
drive2: Specifies the drive the files are to be copied to.

33. MEM
Displays the amount of used and free memory in your system.

MEM [/CLASSIFY | /DEBUG | /FREE | /MODULE modulename] [/PAGE]

/CLASSIFY or /C Classifies programs by memory usage. Lists the size of
programs, provides a summary of memory in use, and lists
largest memory block available.
/DEBUG or /D Displays status of all modules in memory, internal
drivers,
and other information.
/FREE or /F Displays information about the amount of free memory left
in both conventional and upper memory.
/MODULE or /M Displays a detailed listing of a module's memory use.
This option must be followed by the name of a module,
optionally separated from /M by a colon.
/PAGE or /P Pauses after each screenful of information.

Memory Type Total Used Free
---------------- -------- -------- --------
Conventional 640K 69K 571K
Upper 0K 0K 0K
Reserved 384K 384K 0K
Extended (XMS) 64,512K 220K 64,292K
---------------- -------- -------- --------
Total memory 65,536K 673K 64,863K

Total under 1 MB 640K 69K 571K

Total Expanded (EMS) 63M (66,551,808 bytes)
Free Expanded (EMS) 16M (16,777,216 bytes)

Largest executable program size 571K (584,464 bytes)
Largest free upper memory block 0K (0 bytes)
MS-DOS is resident in the high memory area.


34. SORT
Sorts input and writes results to the screen, a file, or another device

SORT [/R] [/+n] [[drive1:][path1]filename1] [> [drive2:][path2]filename2]
[command |] SORT [/R] [/+n] [> [drive2:][path2]filename2]

/R Reverses the sort order; that is, sorts Z to A,
then 9 to 0.
/+n Sorts the file according to characters in
column n.
[drive1:][path1]filename1 Specifies file(s) to be sorted
[drive2:][path2]filename2 Specifies a file where the sorted input is to be
stored.
command Specifies a command whose output is to be
sorted.


35. ZIP
USE TO COMPRESS FILES
Copyright (C) 1990-1997 Mark Adler, Richard B. Wales, Jean-loup Gailly,
Onno van der Linden and Kai Uwe Rommel.
Type 'zip -L' for the software License.
Zip 2.2 (November 3rd 1997). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi
list]
The default action is to add or replace zipfile entries from list, which
can include the special name - to compress standard input.
If zipfile and list are omitted, zip compresses stdin to stdout.
-f freshen: only changed files -u update: only changed or new files
-d delete entries in zipfile -m move into zipfile (delete files)
-R recurse into directories -j junk (don't record) directory names
-0 store only -l convert LF to CR LF (-ll CR LF to
LF)
-1 compress faster -9 compress better
-q quiet operation -v verbose operation/print version info
-c add one-line comments -z add zipfile comment
-@ read names from stdin -o make zipfile as old as latest entry
-x exclude the following names -i include only the following names
-F fix zipfile (-FF try harder) -D do not add directory entries
-A adjust self-extracting exe -J junk zipfile prefix (unzipsfx)
-T test zipfile integrity -X eXclude eXtra file attributes
-! use privileges (if granted) to obtain all aspects of WinNT security
-$ include volume label -S include system and hidden files
-h show this help -n don't compress these suffixes


36. UNZIP
USE TO UNCOMPRESS FILES

UnZip 5.32 of 3 November 1997, by Info-ZIP. Maintained by Greg Roelofs.
Send
bug reports to the authors at Zip-Bugs@lists.wku.edu; see README for details.

Usage: unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]
Default action is to extract files in list, except those in xlist, to
exdir;
file[.zip] may be a wildcard. -Z => ZipInfo mode ("unzip -Z" for usage).

-p extract files to pipe, no messages -l list files (short format)
-f freshen existing files, create none -t test compressed archive data
-u update files, create if necessary -z display archive comment
-x exclude files that follow (in xlist) -d extract files into exdir

modifiers: -q quiet mode (-qq => quieter)
-n never overwrite existing files -a auto-convert any text files
-o overwrite files WITHOUT prompting -aa treat ALL files as text
-j junk paths (do not make directories) -v be verbose/print version
info
-C match filenames case-insensitively -L make (some) names lowercase
-$ label removables (-$$ => fixed disks) -V retain VMS version numbers
-X restore ACLs (-XX => use privileges) -s spaces in filenames => '_'
-M pipe through "more" pager
Examples (see unzip.doc for more info):
unzip data1 -x joe => extract all files except joe from zipfile data1.zip
unzip -fo foo ReadMe => quietly replace existing ReadMe if archive file
newer

37. COPY CON
COPY CON (FILE NAME)

C:\WINDOWS>COPY CON AAAAAA
SSSSSSSSSS
SSSSSSSSS
SSSSSSSS
SSSSSSS
SSSSSSS
SSSSS
SSSS
SSS
SS
S^Z
1 file(s) copied

38. PATH
Displays or sets a search path for executable files.

PATH [[drive:]path[;...]]
PATH ;

Type PATH ; to clear all search-path settings and direct Windows to search
only in the current directory.
Type PATH without parameters to display the current path.
Thank You!:)
Difference between System Software and Application Software Difference between System Software and Application Software Difference between System Software and Application Software Difference between System Software and Application Software

Subject Subject Subject Subject
Application Software Application Software Application Software Application Software System Software System Software System Software System Software
Definition Definition Definition Definition
Application software is computer
software designed to help the user to
perform specific tasks.
System software is computer software designed to
operate the computer hardware and to provide a
platform for running application software.
Purpose Purpose Purpose Purpose It is specific purpose software. It is general-purpose software.
Classification Classification Classification Classification
Package Program,
Customized Program
Time Sharing,
Resource Sharing,
Client Server
Batch Processing Operating System
Real time Operating System
Multi-processing Operating System
Multi-programming Operating System
Distributed Operating System
Environment Environment Environment Environment
Application Software performs in a
environment which created by
System/Operating System
System Software Create his own environment to run
itself and run other application.
Execution Execution Execution Execution
Time Time Time Time
It executes as and when required. It executes all the time in computer.
Essentiality Essentiality Essentiality Essentiality
Application is not essential for a
computer.
System software is essential for a computer
Number Number Number Number
The number of application software is
much more than system software.
The number of system software is less than
application software.
Picture Picture Picture Picture


Introduction to Microsoft Windows Introduction to Microsoft Windows Introduction to Microsoft Windows Introduction to Microsoft Windows
The oldest of all Microsofts operating systems is MS-DOS (Microsoft Disk Operating System).
MS-DOS is a text-based operating system. Users have to type commands rather than use the
more friendly graphical user interfaces (GUIs) available today. Despite its very basic
appearance, MS-DOS is a very powerful operating system. There are many advanced
applications and games available for MS-DOS. A version of MS-DOS underpins Windows.
Many advanced administration tasks in Windows can only be performed using MS-DOS.

The history of Microsoft Windows dates back to 1985, when Microsoft released Microsoft
Windows Version 1.01. Microsofts aim was to provide a friendly user-interface known as a
GUI (graphical user interface) which allowed for easier navigation of the system features.
Windows 1.01 never really caught on. (The amazing thing about Windows 1.01 is that it fitted
on a single floppy disk!). In 1987 Microsoft revamped the operating system and released
Windows 2.03. The GUI was very slightly improved but still looked too similar to Windows
1.01. The operating system again failed to capture a wide audience.
Microsoft made an enormous impression with Windows 3.0 and 3.1. Graphics and
functionality were drastically improved. The Windows 3.x family provided multimedia
capabilities as well as vastly improved graphics and application support.
Building on the success of Windows 3.x, Microsoft released Microsoft Windows For
Workgroups 3.11. This gave Windows the ability to function on a network. It is not uncommon
to find companies still using Windows 3.11.
In 1993 Microsoft divided the operating system into two categories; Business and home user.
Windows NT (New Technology) was a lot more reliable than Windows 3.x. Windows NT
provided advanced network features. On the business front, Windows NT continued to develop
with the release of version 3.51. Different versions were provided which offered different
functionality. Server provided the higher network functions and Workstation was mainly for
the client machines.
In 1995 Windows went through a major revamp and Microsoft Windows 95 was released.
This provided greatly improved multimedia and a much more polished user interface. The now
familiar desktop and Start Menu appeared. Internet and networking support was built in
Although Windows 95 was a home user operating system, it proved to be very popular in
schools and businesses.
After the success of Windows 95, Microsoft improved the GUI interface of Windows NT and
released Windows NT 4.0. NT4 could be tailored to the size of the business, NT4 Server for
small to medium sized businesses and Enterprise Server for larger networks. Microsoft
continued to improve the Windows format. Although Microsoft Windows 98 was very similar
to Windows 95, it offered a much tidier display and enhanced multimedia support.

Breaking with its own naming conventions, Microsoft released Windows 2000 (initially called
NT 5.0) for the business market. It appeared in 4 models: Professional -which replaced
Workstation, Server, Advanced Server and Datacenter Server catered for differing business
requirements.
Although Windows 2000 had a greatly improved user interface, the best of the enhancements
appeared on the server side. Active Directory was introduced which allowed much greater
control of security and organisation. Improvements to the overall operating system allowed for
easier configuration and installation.
One big advantage of Windows 2000 was that operating system settings could be modified
easily without the need to restart the machine. Windows 2000 proved to be a very stable
operating system that offered enhanced security and ease of administration.
The last incarnation of the Windows 9x family was Windows Millennium Edition (ME). There
were many different versions of Windows floating around at this stage that Microsoft decided
the next release of Windows would consolidate both the business and home versions. Although
Windows ME was visually similar to Windows 2000. Windows ME was based on the Windows
9x line. Windows 9x/ME systems are not as secure and stable as Windows NT and 2000
systems.
Because of the stability of Windows NT/2000, Microsoft decided to end the development of the
Windows 9x line, and merge both the consumer and business products. Microsoft Windows XP
comes as the Home Edition and Professional, each is based on Windows 2000. Windows 2000
Server has been upgraded to Windows 2003. This appears in four variants: Web Server,
Standard Server, Enterprise Server and Datacenter Server, each fulfilling a different business
role. Windows XP has a very polished look, but the overall functionality is very similar to
Windows 2000.

STUDY OF UNIX OPERATING SYSTEM STUDY OF UNIX OPERATING SYSTEM STUDY OF UNIX OPERATING SYSTEM STUDY OF UNIX OPERATING SYSTEM
AIM AIM AIM AIM
To introduce the concept of UNIX Operating System
OPERATING SYSTEM OPERATING SYSTEM OPERATING SYSTEM OPERATING SYSTEM
An Operating System is a set of programs that
Functions as an virtual machine by presenting an interface that is easier to program
than the underlying hardware
Acts as resource management through orderly and controlled allocation of the
processors, memories, and I/O devices among the programs competing for it.
OS TYPES OS TYPES OS TYPES OS TYPES
1. Single User Single User Single User Single UserThe system will have its own hard disk, memory, CPU and other resources all
dedicated to a single user. Eg. MS-DOS
2. Multi User Multi User Multi User Multi UserThe users having access to a multi-user system will have just a terminal and a
keyboard. The other resources such as hard disk, printers are centrally located.
The user is expected to simply hook onto his account, perform the work, disconnect and leave
quietly. Eg. UNIX
UNIX HISTORY UNIX HISTORY UNIX HISTORY UNIX HISTORY
The spade work for UNIX began at AT&T Bell Laboratories in 1969 by Ken Thompson and
Dennis Ritchie. The OS was initially known as UNICS (jokingly UNiplexed Information and
Computing System). In 1970 UNICS finally became UNIX. In 1973, UNIX was rewritten in
1973 in C principally authored by Ritchie.
UNIX FEATURES UNIX FEATURES UNIX FEATURES UNIX FEATURES
1. Multi Multi Multi Multi- -- -user system user system user system user systemMulti-user capability of UNIX allows several users to use the same
computer to perform their tasks. Several terminals [Keyboards and Monitors] are connected to
a single powerful computer [UNIX server] and each user can work with their terminals.
2. Multi Multi Multi Multi- -- -tasking system tasking system tasking system tasking systemMultitasking is the capability of the operating system to perform
various task simultaneously, i.e. a user can run multiple tasks concurrently.
3. Programming Facility Programming Facility Programming Facility Programming FacilityUNIX is highly programmable, the UNIX shell has all the necessary
ingredients like conditional and control structures, etc.
4. Security Security Security SecurityUNIX allows sharing of data; every user must have a single login name and
password. So, accessing another users data is impossible without his permission.
5. Portability Portability Portability PortabilityUNIX is portable because it is written in a high level language. So, UNIX can be
run on different computers.
6. CommunicationUNIX supports communication between different terminals of the same
server as well as between terminals on different servers.
Apart from these features, UNIX has an extensive Tool kit, exhaustive system calls and Libraries
and enhanced GUI (X Window).
ORGANIZATION OF UNIX ORGANIZATION OF UNIX ORGANIZATION OF UNIX ORGANIZATION OF UNIX
The UNIX system is functionally organized at three levels and are:
1. The kernel, which schedules tasks and manages storage;
2. The shell, which connects and interprets users' commands, calls programs from memory,
and executes them; and
3. The tools and applications that offer additional functionality to the OS.
The kernel is the heart of the system, a collection of programs written in C that directly
communicate with the hardware. There is only one kernel for any system. It's that part of UNIX
system that is loaded into memory when the system is booted. It manages the system resources,
allocates time between user and processes, decides process priorities, and performs all other
tasks. The kernel, in traditional parlance, is often called the Operating system. The shell, on the
other hand, is the "sleeping beauty" of UNIX. It is actually the interface between the user and
the kernel. The shell is the agency which takes care of the features of redirection and has a
programming capability of its own.
The Tools and Applications consist of Application Software, Compilers, Database Package,
Internet tools, UNIX commands, etc.

FILE SYSTEM
A file in UNIX is nothing but a storehouse of information and everything is treated as a file
by UNIX. The files can be broadly classified as follows:
Ordinary filesContains stream of data. All data, text, source programs, object and
executable code, commands fall into this category.
Directory filesContains no external data. It contains an entry, name of the file and its
inode (identification number) for each file and subdirectory under that directory.
Directory files are not created by the user but by the UNIX system itself.
Device filesEven physical devices are treated as files. These are special in the sense
that any output directed to it will be reflected onto the respective device.

All files in UNIX are related to one another. The file system of UNIX resembles a tree that grows
from top to bottom as shown in the figure. The file system begins with a directory called root
(at the top). The root directory is denoted by a slash (\). Branching from root there are several
directories such as bin, lib, etc, tmp, dev. Each of these directories contains several sub-
directories and files.
Result Result Result Result
Thus the study of UNIX Operating System has been completed successfully.



BASIC COMMANDS BASIC COMMANDS BASIC COMMANDS BASIC COMMANDS
Aim Aim Aim Aim
To study and execute Unix commands.

Unix is security conscious, and can be used only by those persons who have an account. Telnet
(Telephone Network) is a Terminal emulator program for TCP/IP networks that enables users to
log on to remote servers. To logon, type telnet server_ipaddress in run window.
User has to authenticate himself by providing username and password. Once verified, a
greeting and $ prompt appears. The shell is now ready to receive commands from the user.
Options suffixed with a hyphen () and arguments are separated by space.


1 11 1. .. . General commands General commands General commands General commands
Command Command Command Command Function Function Function Function
date Used to display the current system date and time.
date +%D Displays date only
date +%T Displays time only
date +% Y Displays the year part of date
date +% H Displays the hour part of time
cal Calendar of the current month
cal year Displays calendar for all months of the specified year
cal month year Displays calendar for the specified month of the year
who Login details of all users such as their IP, Terminal No, User name,
who am i Used to display the login details of the user
tty Used to display the terminal name
uname Displays the Operating System
uname r Shows version number of the OS (kernel).
uname n Displays domain name of the server
echo "txt" Displays the given text on the screen
echo $HOME Displays the user's home directory
bc Basic calculator. Press Ctrl+d Ctrl+d Ctrl+d Ctrl+d to quit
lp file Allows the user to spool a job along with others in a print queue.
man cmdname Manual for the given command. Press q q q q to exit
history To display the commands used by the user since log on.
exit Exit from a process. If shell is the only process then logs out

2. 2. 2. 2. Directory commands Directory commands Directory commands Directory commands

Command Command Command Command Function Function Function Function
Pwd Path of the present working directory
mkdir dir A directory is created in the given name under the current directory
mkdir dir1 dir2 A number of sub-directories can be created under one stroke
cd subdir Change Directory. If the subdir starts with / / / / then path starts from root root root root
(absolute) otherwise from current working directory.
cd To switch to the home directory.
cd / To switch to the root directory.
cd .. To move back to the parent directory
rmdir subdir Removes an empty sub-directory.

3. 3. 3. 3. File commands File commands File commands File commands
Command Command Command Command Function Function Function Function
cat > filename To create a file with some contents. To end typing press Ctrl+d Ctrl+d Ctrl+d Ctrl+d. The > > > >
symbol means redirecting output to a file. (< < < < for input)
cat filename Displays the file contents.
cat >> filename Used to append contents to a file
cp src des Copy files to given location. If already exists, it will be overwritten
cp i src des Warns the user prior to overwriting the destination file
cp r src des Copies the entire directory, all its sub-directories and files.
mv old new To rename an existing file or directory. i option can also be used
mv f1 f2 f3 dir To move a group of files to a directory.
mv v old new Display name of each file as it is moved.
rm file Used to delete a file or group of files. i option can also be used
rm * To delete all the files in the directory.
rm r * Deletes all files and sub-directories
rm f * To forcibly remove even write-protected files
ls Lists all files and subdirectories (blue colored) in sorted manner.
ls name To check whether a file or directory exists.
ls name* * * * Short-hand notation to list out filenames of a specific pattern.
ls a Lists all files including hidden files (files beginning with . .. .)
ls x dirname To have specific listing of a directory.
ls R Recursive listing of all files in the subdirectories
ls l Long listing showing file access rights (read/write/execute-rwx rwx rwx rwx for
user/group/others- -- -ugo ugo ugo ugo).
cmp file1 file2 Used to compare two files. Displays nothing if files are identical.
wc file It produces a statistics of lines (l ll l), words(w ww w), and characters(c cc c).
chmod perm file Changes permission for the specified file. (r=4, w=2, x=1) chmod 740 file
sets all rights for user, read only for groups and no rights for others

The commands can be combined using the pipeline (|) operator. For example, number of users
logged in can be obtained as.
who | wc -l
Finally to terminate the unix session execute the command exit exit exit exit or logout logout logout logout.

Result Result Result Result
Thus the study and execution of Unix commands has been completed successfully.





























UNIX Examination UNIX Examination UNIX Examination UNIX Examination
1. a. write and execute the following UNIX Commands
(1) Create a file
(2) Display only the first two characters of all the lines from a file.
(3) Convert the lower case to uppercase
(4) Combine two strings
(5) Display the file contents in descending order.
2. a. write and execute the following UNIX commands
(i) Create two files with the name of name.txt which contain only names, and reg.txt with
the content of register number respectively.
(ii) Combine the two files in the form of register number followed number followed by
name
(iii) Count the number of lines in the files
(iv) Rename the two files.
3. a. write and execute the following UNIX commands
(i) create two files
(ii) combine two files
(iii) Search a specific word from any one of the file.
(iv) Search a specific file from a directory.
(v) Display the command and distinct line of contents from a file.
4. a. write and execute the following UNIX commands
(i) Create two files.
(ii) Display the contents of both the files.
(iii) Count the number of characters in both the files.
(iv) Rename the two files.
(v) Combine the two files without duplicate.
5. a. write and execute the following UNIX commands
(i) to view all the files and directories page by page
(ii) to view only the directories page by page
(iii) to view only the files in a directory
(iv) Display the working directory.
6. a. write and execute the following UNIX commands
(i) Display the calendar.
(ii) Execute more than one command at a time (using semicolon;)
(iii) Display the users full details.
(iv) Display the user-id/group-id.
(v) Execute more than one command at a time (using logical-AND &&).
7. a. write and execute the following UNIX commands
(i) demonstrate tee command
(ii) use more than one command at a time(who and date)
(iii) create a file called create.txt
(iv) move the file create.txt to move.txt
8. a. write and execute the following UNIX commands
(i) create a file
(ii) Print the specified number of lines of a file from start to end of the file.
(iii) Display the file content with line number.
(iv) Update the file content with I/O redirection.
(v) Rename the file.
9. a. write and execute the following UNIX commands
(i) create a file
(ii) rename the directory
(iii) rename the file
(iv) view the file
10. a. write and execute the following UNIX commands
(i) create a file
(ii) update the file
(iii) display the file content
(iv) Display the file with line number.
(v) Count the number of words in the file.
11. a. write and execute the following UNIX commands
(i) create a Directory called main
(ii) create a sub-directory called sub in the main directory
(iii) create a file to the sub directory
(iv) Delete the file in the main directory
12. a. write and execute the following UNIX commands
(i) Display the calendar
(ii) Display the date and time
(iii) Display the present working directory
(iv) Display your user name
(v) Create a file using cat command
13. a. write and execute the following UNIX commands
(i) use finger command
(ii) use grep command
(iii) use diff command
(iv) use uniq command
(v) use comp command
14. a. write and execute the following UNIX commands
(i) create a directory
(ii) view all directories from a user
(iii) Rename a directory
(iv) View all the directories starting with a specific character.
(v) View only the hidden directories.
15. Write and execute the following UNIX commands
(i) Create a file
(ii) View only files form a directory
(iii) Rename a file
(iv) View all files starting with a specific character
(v) View all the files which has a specific extension
16. a. write and execute the following UNIX commands
(i) create a directory with the name of Exam
(ii) change the Exam directory as the working directory
(iii) create a file called exam.txt in the Exam directory
(iv) view the content of the exam.txt file
(v) rename the file exam.txt to test.txt
17. a. write and execute the following UNIX commands
(i) to check the working directory
(ii) change the password
(iii) to display todays date
(iv) to display the calendar of this month.
(v) To display a message university Exam using special character
18. a. write and execute the following UNIX commands
(i) create two directories called cs1101 and cs1102
(ii) create a file called cs1101.txt in the cs1101 directory
(iii) copy the file cs1101.txt from cs11001 to cs1102
(iv) update the file content of cs1101.txt in the cs1102 directory
(v) rename the file in the cs11012 with cs1102.txt
19. a. write and execute the following UNIX commands
(i) create a file
(ii) rename a file
(iii) change the mode of the file to read only
(iv) View the content of a file.
(v) Count the number of words in a file.
20. a. write and execute the following UNIX commands
(i) Count the specific number of lines from a file start from the beginning of the file.
(ii) To destroy a specific file from a user directory
(iii) Send a greeting message to the other user
(iv) Execute a shell program
(v) To display current time.


Answer Answer Answer Answer - -- -
UNIX UNIX UNIX UNIX
Examination Examination Examination Examination




Answer Answer Answer Answer - -- -UNIX Examination UNIX Examination UNIX Examination UNIX Examination
1. a. write and execute the following UNIX Commands
(1) Create a file
student@linuxmint-$ cat >test
My first file in Linux
Linux is a multiuser OS
(2) Display only the first two characters of all the lines from a file.
student@linuxmint-$ cat c1-2 test
My
Li
(3) Convert the lower case to uppercase
student@linuxmint-$ tr[:lower:][:upper:] <test
MY FIRST FILE IN LINUX
LINUX IS A MULTI_USER OS
(4) Combine two strings
student@linuxmint-$ n=narayana
student@linuxmint-$ s=swamy
student@linuxmint-$ echo $n$s
narayanaswamy
(5) Display the file contents in descending order.
student@linuxmint-$ cat >1.txt
narayana
vimala
kamala
student@linuxmint-$ sort r 1.txt
vimala
narayana
kamala
2. a. write and execute the following UNIX commands
(i) Create two files with the name of name.txt which contain only names, and reg.txt with
the content of register number respectively.
student@linuxmint-$ cat >name.txt
narayana
vimala
student@linuxmint-$ cat > reg.txt
1050092
1050093
(ii) Combine the two files in the form of register number followed number followed by
name.
student@linuxmint-$ paste reg.txt name.txt
1050092 narayana
1050093 vimala
(iii) Sort the two files in ascending order
student@linuxmint-$ sort name.txt
narayana
vimala
student@linuxmint-$ sort reg.txt
1050092
1050093
(iv) Count the number of lines in the files.
student@linuxmint-$ wc l name.txt
2 name.txt
student@linuxmint-$ wc l reg.txt
2 reg.txt
(v) Rename the two files.
student@linuxmint-$ mv i reg.txt reg1.txt
student@linuxmint-$ mv l name.txt name1.txt
3. a. write and execute the following UNIX commands
(i) create two files.
student@linuxmint-$ cat >a1
welcome to
student@linuxmint-$ cat >a2
UNIX Operating System
(ii) combine two files
student@linuxmint-$ cat a2 >>a1
student@linuxmint-$ cat a1
Welcome to
UNIX Operating System
(iii) Search a specific word from any one of the file.
student@linuxmint-$ grep UNIX a1
UNIX Operating System
(iv) Search a specific file from a directory.
student@linuxmint-$ ls
1.txt a2 Downloads name1.txt prince.zip Templates
2.txt asd final.txt name.txt public test
3.txt cam.txt mmm.odt Pictures q.txt Videos
5.txt Desktop Music Prince19.9.11 reg1.txt w.txt
a1 Documents naasa.c prince 19.9.11.tar reg.txt
student@linuxmint-$ cd Documents
student@linuxmint-/Documents $ ls
5.txt Desktop Music prince 19.9.11 reg1.txt w.txt
a1 Documents naasa.c prince 19.9.11.tar reg.txt
student@linuxmint-$ cd Documents
student@linuxmint-/Documents $ ls
econ omicguru.doc laxmi.odp wwcChallanges.pdf
economiccguru.odt Untitled 1.doc
student@linuxmint-/Documents $ find*.doc
economiccguru.doc
Untitled 1.doc
(v) Display the command and distinct line of contents from a file.
student@linuxmint-$ cat >q1
name is narayan
test
student@linuxmint-$ cat >q2
name is kamal
test
student@linuxmint-$ comm. -12 q1 q2
test
4. a. write and execute the following UNIX commands
(i) Create two files.
student@linuxmint-$ cat >file1
Narayana
student@linuxmint-$ cat >file2
Swamy
(ii) Display the contents of both the files.
student@linuxmint-$ cat file1
Narayana
student@linuxmint-$ cat file 2
SWamy
(iii) Count the number of characters in both the files.
student@linuxmint-$ wc m file1
9 file1
student@linuxmint-$ wc m file2
6 file2
(iv) Rename the two files.
student@linuxmint-$ mv i file 1 fileone
student@linuxmint-$ cat fileone
Narayana
student@linuxmint-$ mv i file2 filetwo
student@linuxmint-$ cat filetwo
Swamy
(v) Combine the two files without duplicate.
student@linuxmint-$ cat filetwo >> fileone
student@linuxmint-$ cat fileone
Narayana
Swamy
5. a. write and execute the following UNIX commands
(i) to view all the files and directories page by page
student@linuxmint-$ ls-a |pg
(ii) to view only the directories page by page.
student@linuxmint-$ ls d*/|pg
(iii) to view only the files in a directory
student@linuxmint-$ ls-d*.*|pg
(iv) Display the working directory.
student@linuxmint-$ pwd
(v) Display the complete path of the working directory.
student@linuxmint-$ pwd d
/home/student
6. a. write and execute the following UNIX commands
(i) Display the calendar.
student@linuxmint-$ cal
February 2012
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29
(ii) Execute more than one command at a time (using semicolon;)
student@linuxmint-$ date;time
Mon Feb 6 22:44:08 PST 2012
real 0m0.000s
user 0m0.000s
sys 0m0.000s
(iii) Display the users full details.
student@linuxmint-$ who
student tty7 2012-02-06 19:37(:0)
student pts/0 2012-02-06 20:15(:0.0)
(iv) Display the user-id/group-id.
student@linuxmint-$ id u
1001
student@linuxmint-$ id g
1001
(v) Execute more than one command at a time (using logical-AND &&).
student@linuxmint-$ date && time
Mon Feb 6 22:53:37 PST 2012
real 0m0.000s
User 0m0.000s
Sys 0m0.000s
7. a. write and execute the following UNIX commands
(i) demonstrate pipe command
student@linuxmint-$ who |wc-l
2
(ii) demonstrate tee command
student@linuxmint-$ who|tee sample|wc-l
2
student@linuxmint-$ cat sample
student tty7 2012-02-06 19:37(:0)

student pts/0 2012-02-06 20:15(:0.0)
(iii) use more than one command at a time(who and date)
student@linuxmint-$ who:date
student tty7 2012-02-06 19:37(:0)
student pts/0 2012-02-06 20:15(:0.0)
Mon Feb 6 22:55:05 PST 2012
(iv) create a file called create.txt.
student@linuxmint-$ cat>create.txt
Narayana Swamy
(v) move the file create.txt to move.txt
student@linuxmint-$ mv create.txt move.txt
student@linuxmint-$ cat move.txt
Narayana Swamy
8. a. write and execute the following UNIX commands
(i) create a file
student@linuxmint-$ cat >ex1
Narayana
Kamala
Vimala
Sudha
Sooriya
Hemanad
(ii) Print the specified number of lines of a file from start to end of the file.
student@linuxmint-$ head -2 ex1
Narayana
Kamala
(iii) Display the file content with line number.
student@linuxmint-$ nl ex1
1 narayana
2 Kamala
3 Vimala
4 Sudha
5 Sooriya
6 Hemanad
(iv) Update the file content with I/O redirection.
student@linuxmint-$ date >ex1
student@linuxmint-$ cat ex1
Mon Feb 6 23:07:27 PST 2012
(v) Rename the file.
student@linuxmint-$ mv ex1 ex2
student@linuxmint-$ cat ex2
Mon Feb 6 23:07:27 PST 2012
student@linuxmint-$ cat ex1
cat:ex1:No such file or directory
9. a. write and execute the following UNIX commands
(i) create a directory
student@linuxmint-$ mkdir mechanical
(ii) create a file
student@linuxmint-$ cat >mech
(iii) rename the directory
student@linuxmint-$ mv mechanical civil
(iv) rename the file
student@linuxmint-$ mv mech civ
(v) view the file
student@linuxmint-$ cat civ
Majestic Mechanical
10. a. write and execute the following UNIX commands
(i) create a file
student@linuxmint-$ cat >home.txt
my name is nnarayana
(ii) update the file
student@linuxmint-$ cat>home.txt
my name is nnarayana Swamy
(iii) display the file content
student@linuxmint-$ cat >home.txt
My name is narayana swamy
(iv) Display the file with line number.
student@linuxmint-$ nl home.txt
1 my name is Narayana Swamy
(v) Count the number of words in the file.
student@linuxmint-$ wc w home.txt
5 home.txt
11. a. write and execute the following UNIX commands
(i) create a Directory called main
student@linuxmint-$ mkdir main
(ii) create a sub-directory called sub in the main directory.
student@linuxmint-$ cd main
student@linuxmint-/main $ mkdir sub
(iii) create a file in the main directory.
student@linuxmint-/main/sub $ cd-
/home/student/main
student@linuxmint-/main $ cat >test.txt
GGV
(iv) create a file to the sub directory.
student@linuxmint-/main $ cp test.txt /home/student/main/sub.s
(v) Delete the file in the main directory
student@linuxmint-/main $ rm test.txt
12. a. write and execute the following UNIX commands
(i) Display the calendar
student@linuxmint-$ cal
February 2012
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29
(ii) Display the date and time.
student@linuxmint-/main/sub $date;time
Mon Feb 6 23:48:43 PST 2012
real om0.000s
user 0m0.000s
sys 0m0.000s
(iii) Display the present working directory
student@linuxmint-/main/sub $ pwd
/home/student/main/sub
(iv) Display your user name
student@linuxmint-/main/sub $ who am i
student
(v) Create a file using cat command
student@linuxmint-/main/sub $ cat >mech.txt
we are the first year students.
13. a. write and execute the following UNIX commands
(i) use finger command
(ii) use grep command
student@linuxmint-$ cat >wow.txt
running out off words. Wow!
student@linuxmint-$ grep wowwow.txt
running out off words. Wow!
(iii) use diff command
student@linuxmint-$ cat>hurry.txt
running out off terms.HURRY!
student@linuxmint-$ diff wow.txt hurray.txt
1c1
< running out off words. Wow!
.
> running out off terms.HURRY!
(iv) use uniq command
student@linuxmint-$ cat >myfile.txt
narayana
kamala
sudha
sharmila
nisha
sangeeta
nisha
narayana
student@linuxmint-$ sort myfile.txt|uniq
kamala
narayana
nisha
sangeeta
sharmila
sudha
(v) use comp command
student@linuxmint-$ cmp myfile.txt wow.txt
myfile.txt wow.txt differ:byte1, line 1
14. a. write and execute the following UNIX commands
(i) create a directory
student@linuxmint-$ mkdir directory
(ii) view all directories from a user
student@linuxmint-$ ls d */
asd/ directory/ main/ pictures/ templates/ civil documents/ mechanical /prince19.9.11/
videos/ videos/ desktop/downloads/music/public
(iii) Rename a directory
student@linuxmint-$ mv directory direct
(iv) View all the directories starting with a specific character.
student@linuxmint-$ ls d m*/
main/ mechanical/
(v) View only the hidden directories.
student@linuxmint-$ ls-a-d
15. Write and execute the following UNIX commands
(i) Create a file
student@linuxmint-$ cat>sonali
my name is sonali
(ii) View only files form a directory
student@linuxmint-$ ls *.*
1 txt 5.txt home.txt naasa.c prince 19.9.11.tar
(iii) Rename a file
student@linuxmint-$ cat sonali
(iv) View all files starting with a specific character
student@linuxmint-$ ls na*
naasa.c name1.txt name.txt
(v) View all the files which has a specific extension.
student@linuxmint-$ ls *.txt
16. a. write and execute the following UNIX commands
(i) create a directory with the name of Exam.
student@linuxmint-$ mkdir exam
(ii) change the Exam directory as the working directory.
student@linuxmint-$ cd exam
student@linuxmint-/Exam $
(iii) create a file called exam.txt in the Exam directory
student@linuxmint-/Exam $ cat >exam.txt
i will secure more marks in examination.
(iv) view the content of the exam.txt file
student@linuxmint-/Exam $ cat exam.txt
i will secure more marks in examination.
(v) rename the file exam.txt to test.txt
student@linuxmint-/Exam $ mv exam.txt test.txt
17. a. write and execute the following UNIX commands
(i) to check the working directory
student@linuxmint-/Exam $ pwd
/home/student/Exam
(ii) change the password
student@linuxmint-Exam $ passwd
changing password for student
(current )UNIX password:
Enter new UNIX password:
Retype new UNIX password:
Bad:new password too simple
Enter new UNIX password:
Retype new UNIX password:
Passwd:password updated successfully
(iii) to display todays date
student@linuxmint-/Exam $ date +%d
(iv) to display the calendar of this month.
student@linuxmint-/Exam $ cal 02 2014
(v) To display a message university Exam using special character
student@linuxmint-$ u=U
student@linuxmint-$ n=n
student@linuxmint-$ i=!
student@linuxmint-$v=V
student@linuxmint-$ e=E
student@linuxmint-$ r=#
student@linuxmint-$ s=$
student@linuxmint-$ i=!
student@linuxmint-$ t=T
student@linuxmint-$ y=Y
student@linuxmint-$ e=E
student@linuxmint-$ x=*
student@linuxmint-$a=@
student@linuxmint-$ m=M
student@linuxmint-$ echo $u$n$i$v$e$r$s$i$t$y$e$x$a$m
un!VE#$!TYE*@M
18. a. write and execute the following UNIX commands
(i) create two directories called cs1101 and cs1102
student@linuxmint-$ mkdir cs1101
student@linuxmint-$ mkdir cs1102
(ii) create a file called cs1101.txt in the cs1101 directory
student@linuxmint-$ cat >/home/student/cs1101/cs1101.txt
(iii) copy the file cs1101.txt from cs11001 to cs1102
student@linuxmint-$ cat >/home/student/cs1101/cs1101.txt
/home/student/cs1102
(iv) update the file content of cs1101.txt in the cs1102 directory
student@linuxmint-$ cd cs1102
student@linuxmint-/cs1102 $cat cs1101.txt
...
student@linuxmint-/cs1102 $cat cs1101.txt
student@linuxmint-/cs1102 $
19. rename the file in the cs11012 with cs1102.txt
student@linuxmint-/cs1102 $ mv cs1101.txt cs1102.txt
student@linuxmint-/cs1102 $ cat cs1102.txt
20. a. write and execute the following UNIX commands
(i) create a file
(ii) student@linuxmint-/cs1102 $ cat
student@linuxmint-/cs1102 $ cat summa.txt
(iii) rename a file
student@linuxmint-/cs1102 $ mv summa.txt namesake.txt
student@linuxmint-/cs1102 $ cat nameskae.txt
(iv) change the mode of the file to read only
student@linuxmint-/cs1102 $ ls -l namesake.txt
-rw-r--r--1 student 43 2012-02-07 00.52 namesake.txt
student@linuxmint-/cs1102 $ chmod u-w namesake.txt
student@linuxmint-/cs1102 $ ls-l namesake.txt
(v) View the content of a file.
student@linuxmint-/cs1102 $ cat namesake.txt
(vi) Count the number of words in a file.
student@linuxmint-/cs1102 $ wc -w namesake.txt
21. a. write and execute the following UNIX commands
(i) Count the specific number of lines from a file start from the beginning of the file.
student@linuxmint-$cat >desktop.txt
.
student@linuxmint-$ head -3 desktop.txt
.
student@linuxmint-$
.
(ii) To destroy a specific file from a user directory
student@linuxmint-$ rm desktop.txt
(iii) Send a greeting message to the other user

(iv) Execute a shell program
student@linuxmint- $ cat >shell.sh
echoenter your name
read name
(v) To display current time.
student@linuxmint-/cs1102 $ date +%T