Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
3 views22 pages

Unit 202

Uploaded by

ayshaazmiya66
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views22 pages

Unit 202

Uploaded by

ayshaazmiya66
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Unit -2

1. Computer software

INTRODUCTION
A computer system consists of hardware, the electronic devices that are capable of computing and
manipulating information, and software that carries out predefined tasks to complete a given job.
The sets of instructions, which control the sequence of operations, are known as programs, and
collectively programs are called software.

SOFTWARE DEFINITION
Software is a generic term for organized collection of computer data and instructions. A software
tells the computer what to do and how to do it. For ex, software instructs the hardware what to
display on the user’s screen, what kind of input to take from the user, and what kinds of output to
generate.
A computer needs to be instructed to perform any task. These instructions are given in the form of
computer programs, which are written in computer programming languages.

RELATIONSHIP BETWEEN SOFTWARE AND HARDWARE

Software refers to the computer programs that are loaded into a computer system, and hardware
refers to all the visible devices, which are assembled together to build a computer system .Hardware
is like a car without a driver; one needs both to get the work done. Software is a set of instructions
that tells the hardware what to do and how to perform the requested action . Thus, hardware and
software share a special relationship. If hardware is the "heart" of a computer system software is its
"soul." Both are
complementary to each other.

CATEGORIES OF SOFTWARE

Software can be categorized as system software and application software. System software is a
generic term for referring to any computer program whose purpose is to help the user to run the
computer system, whereas application software employs the capabilities of a computer directly to a
task that the user wishes to perform.
System software
System software consists of several programs, which are directly responsible for controlling,
integrating, and managing the individual hardware components of a computer system.
System software is more transparent and less noticed by the users as it usually
interacts with the hardware or the applications. This software provides a programming
environment in which programmers can create applications to accommodate their needs.
System software acts as an interface between the hardware of the computer and the software
applications. System software makes the computer functional. Some examples

of system software are operating systems, device drivers, language translators, and system
utilities.
Application software
Software by a user is the application software. For a user, the computer system has
no specific use without the application software Application software may consist of a single
program, such as Microsoft's Notepad (for writing and editing simple text), or a collection of
programs, which work together to accomplish a task such as database management software
Application software is dependent on system software. A system software (like
operating system) acts as an interface between the user and the computer hardware, while
application software performs specific tasks.

Some of the most commonly used application software, Word processors, spreadsheets, Image
Editors, Database Management systems.

System software

Operating system:

• It is the first layer of software loaded into the computer memory when it start up.

• As the first software layer, all other software that gets loaded after it depends on it for various
common core services.

• These common core service include disk access, memory management, task scheduling and
user interfacing.

• The operating system organizes and control the hardware.

• Ex: window xp, UNIX and Linux.


Basic functions of operating system are:

• Process Management: It handles the creation, deletion , suspension, and resumption and
synchronization of process.

• Memory Management: It handles the allocation and deallocation of memory space as


required by various programs.

• File Management: It is responsible for the creation and deletion of files and directories. It
also organizes, stores, retrieves, names and protect all the files.

• Device Management: It manages the all the devices of the computer system such as printer
and modems. If any device failure and notifies the same to the user.

• Security Management: It protects system resource and information against destruction and
unauthorized use.

• User Interface: It provides the interface between the user and hardware.

Device driver:

• Device drivers are system program, which are responsible for proper functioning of device.

• Every device, whether it is a printer , monitor, mouse, or keyboard has a driver program
associated with it for its proper functioning.

• Whenever a new device is added to the computer system, a new device driver must be
installed before the device is used.

Language Translator:

• Computer only understands machine language that language consists of 0’s and 1’s. However
it is difficult for a programmer to understand the machine language.

• To ease the burden of programmer, special programming language called high level
programming language were developed to resemble natural language like English.

• Since computer understands only machine language, a tool is required which could translate
a program written in high level programming language to machine language.

• Language translator are divided into three categories: Compiler, interpreter, and assembler.
System utilities:

System utility program performs day to day task related to the maintenance of the computer
system.

Most common functions of system utilities include:

• File Management: These utilities make it easier to manage the data files. Many programs
are written to help users to find the files, create and organizes directories, copy , move and
remove files.

• Backup: sometimes, that some data files are corrupted or deleted. In such cases, data backup
become very useful.

• Data Recovery: It is the process of retrieving deleted or inaccessible data from failed
electronic storage media such as hard disk drive, optical device etc. The data might become
inaccessible due to software problem, computer viruses. Using data recovery tools, an
experienced technician can successfully recover 80 to even 100 percent lost data.

• Virus protection: Antivirus programs are essential system utilities for a computer system
functioning in a network. They provide the security to the system from viruses that can
damage the computer system.

• Disk Management: Disk Management is a system utility in Windows that enables you to
perform advanced storage tasks.disk management include various software like disk
defragmenter, data compressor, and disk formatting tools.

• Firewall: Firewall are commonly used to protect information such as email and data files.
Fire wall is designed to protect a computer from unauthorized access , especially through
network.

• Disk cleanup: To keep a computer running smoothly. Disk cleanup on regular basis can
significantly improve the system performance.

Application Software

An application (app), application program or application software is a computer


program designed to help people perform an activity. The most often seen software by a user
is the application software. For a user the computer system has no specific use without the
application software. Application software is dependent on system software. A system
software acts as an interface between the user and the computer hardware, while application
software performs a specific task.

Application software ranges from games, calculators and word processor , to program that
paint images on screen. Applications represent real world tasks. They can be easily devided
by looking at exactly what function they serve. Some of the most commonly used application
software discussed below:
Word Processor:

Word Processing refers to the act of using a computer to create, edit, save and print documents. In
order to perform word processing, specialized software (known as a Word Processor) is needed. One
example of a Word Processor is Microsoft Word, but other word processing applications are also
widely used. Examples include: Microsoft Works Word Processor, Open Office Writer, Word
Perfect and Google Drive Document..

These programs allow users to create a wide variety of documents including (but certainly not
limited to) reports, letters, memos, newsletters and brochures. In addition to typing text, the word
processor allows you to add content such as pictures, tables, and charts to your documents as well as
decorative items including borders and clipart.

The editing and formatting capabilities of the word processor demonstrate the application's true
power. Text can be inserted, edited, moved, copied or deleted within your document and the
appearance of the text can be modified in numerous ways. Most word processors also give your the
ability to check your spelling and grammar and many have built in dictionaries and other tools to
assist you in your writing.

Spread sheet: one of the first commercial uses of computer was in processing payroll and other
financial records so the programs were designed to generate reports in the standard “spread sheet “
format used by bookkeepers and accountants. A spread sheet application is rectangular grid, which
allows text, numbers and complex functions to be entered into a matrix of thousands of individual’s
cells. The spread sheet containing cells, each of which may contain text and/ or numbers. Cells may
also contain equations that calculate the results from the data placed in other cells or series of cells.

Spread sheet is used predominantly for accounting and other numerically based tasks, because
financial and mathematical data and analysis are often managed in a tabular style with columns of
financial figures being manipulated and then influencing other data computations. Microsoft excel
and Lotus 1-2-3 are examples of spread sheet applications.

Image Editor: Image editor programs are designed specifically for capturing , creating , editing and
manipulating images. These graphic programs provide a variety of special features for creating and
altering images. In addition to offering a host of filters and image transformation algorithms , some
image editors also enable the user to create and superimpose layers. Most graphic programs have the
ability to import and export one or more graphic file formats. With image editing software one can
darken or lighten an image , rotate it, adjust it contrast, crop out extraneous detail and much more.
Example : adobe Photoshop, CorelDraw.

Database Management Systems: Database Management software is a collection of computer


program that allow storage, modification and extraction of information from a database in an
efficient manner. It provide the tools for input, verification, storage, retrieval , query and
manipulation. When such software is used, information systems can be changed much more easily as
the organizations information requirements change. It also controls the security and integrity of the
database from unauthorized access.
FoxPro, MS- Access, and Oracle are database management system.

Presentation Applications: A presentation means expressing the ideas in the form of visual images,
audio, and animation. To prepare presentation, presentation software is used. Presentation software
allows the users to create presentation by producing slides or hand-outs for presentation of projects.
Essentially such computer program allows users to create a variety of visually appealing electronics
slides for presentation; Microsoft PowerPoint is one of the most famous presentation applications.

Desktop Publishing Software: The term desktop publishing is usually used to describe the creation
of printed documents using a desktop computer. It is a technique of using a personal computer to
design images and pages, assemble type and graphics and then using a laser printer or image setter to
output the assembled pages on to paper, film, or printing plate. Desktop publishing software is used
for creating magazines, books, newsletters and so on. Such software assist in creating sophisticated
documents including complicated page designs, detailed illustrations, and camera ready typefaces.
Quark Express, and Adobe PageMaker are desktop publishing software.
2. Computer programming languages

INTRODUCTION

To write computer programs, a computer or programming language is required, as computer do not


understand natural languages. A programming language consist of a set of characters, symbols and
usage rules that allow the user to communicate with computers just as natural languages are used for
communication among human beings.

DEVELOPING A PROGRAM

A program consist of a series of instruction that a computer process to perform the required
operation. It also includes some fixed data required to perform the instruction and the process of
defining those instruction and data.

In order to design a program , a programmer must determine three basic principles:

 The instruction to be performed

 The order in which those instructions are to be performed.

 The data required to perform those instructions.

To perform a task using a program, inputs of the program along with the process, which is required
to convert the input into desired output. Suppose we want to calculate the sum of two numbers A and
B, and store the sum in C; here A and B are inputs , addition is the process and c is the output of the
program.

PROGRAM DEVELOPMENT CYCLE

The following are six steps in the Program Development Life Cycle:

1. Analyze the problem. The computer user must figure out the problem, then decide how to
resolve the problem - choose a program.
2. Design the program. A flow chart is important to use during this step of the PDLC. This is a
visual diagram of the flow containing the program. This step will help you break down the
problem.
3. Code the program. This is using the language of programming to write the lines of code. The
code is called the listing or the source code. The computer user will run an object code for this
step.
4. Debug the program. The computer user must debug. This is the process of finding the "bugs"
on the computer. The bugs are important to find because this is known as errors in a program.
5. Formalize the solution. One must run the program to make sure there are no syntax and logic
errors. Syntax are grammatical errors and logic errors are incorrect results.
6. Document and maintain the program. This step is the final step of gathering everything
together. Internal documentation is involved in this step because it explains the reasoning one
might of made a change in the program or how to write a program
TYPES OF PROGRAMMING LANGUAGES

Programming languages can be divided in to three major categories

1. Machine language : It uses only 0’s and 1’s to represent the data and instructions

2. Assembly language : It correspondences symbolic instructions and executable machine codes.

3. High-level language : These languages are written using a set of words and symbols following
some rules similar to a natural language such as English. The programs written in HLL are known
as source programs and these programs are converted into machine readable form by using compiler
or interpreter.

GENERATION OF PROGRAMMING LANGUAGES

We can illustrate of all the languages in five generation.

1. First generation: Machine language

The First language was binary also known as machine language which was used in the earliest
computers and the machines. Every instructions and data should be written using 0’s and 1’s.
Machine language is also known as the computers ”native” language as this system of codes is
directly understood by the computer. Instruction in machine language consists of two parts. The
first part is an operation which tells the computer what function are to be performed. The second
part of the instruction is the operand, which tells the computer where to find or store the data on
which the desired operation is to be performed.

OPCODE OPERAND

(Operation Code) (Memory Location)


In machine language, the programmer has to remember the codes of the instruction and supply the
numeric addresses. In addition to the above, he has to keep track of the storage locations of the data
and instructions. In machine language the initial coding often took months; it was expensive, prone
to errors and error correction was a tedious process.

2. Second generation: Assembly language

This language assigns a mnemonic code to each machine language instruction to make it easier to
remember or write. An assembly language provides a mnemonic instruction, usually 3 letters long,
corresponding to each machine instruction. The letters are usually indicating what the instruction
does. For example, ADD is used to perform an addition operation, SUB for subtraction, and so on.
Assembly languages make it easier for humans to remember how to write instructions to the
computer.

Each line of assembly language program consists of 4 columns called fields. The general format of
an assembly instruction is as follows.

[Label] <opcode><operands> [; comment]

[…] brackets indicate that enclosed specification may or may not appear in a statement. If a label is
specified, it is associated as a symbolic name with the machine words generated for the assembly
statement. If multiple operands are used, each of them is separated by a comma. The text after
semicolon (;
) is just comments. Comments are not a part of actual program, but are used just for reference
purposes, ie, to specify what actually the statement will do.

Label Opcode Operands Comments

BEGIN ADD A,B ;ADD B to A

Assembler The assembly language must be translated into machine code by a separate program
called an assembler

Functions of Assembler
i) The Assembler translates the function code into its machine code equivalent.

ii) It assigns absolute addresses to any symbolic address or label names.

iii) It places each instruction in central memory.

iv) It identifies indirect addresses from direct addresses, and sets the appropriate bit in the address
portion of the instruction.

v) It checks the syntax of each instruction and generates error messages.

vi) It provides, optionally, a cross reference table between all symbolic names and their absolute
addresses.

vii) It instructs the control unit to execute the program after all errors have been corrected.

Advantages of Assembly Languages

i) They save time and reduce detail as compared to machine language.

ii) Lesser number of errors are made, and also errors are easier to detect.

iii) Assembly programs are easier to modify than machine language programs.

Disadvantages of Assembly Languages

i) Writing a code is time-consuming.

ii) Assembly languages are machine-dependent.

3. Third generation : High- level language

Languages such as COBOL, BASIC and C are examples of 3GLS and are consider HLL. HLL are
similar to the English language. Programs written using these languages can be machine
independent. A single high-level statement can substitute several instructions in machine or
assembly language. In a high- level language, programs are written in a sequence of statement to
solve a problem. For ex, the following BASIC code will calculate the sum of 2 numbers.

LET X=10

LET Y=20

LET SUM=X+Y

PRINT SUM
The first two statement store 10 in variable x and 20 in variable y. The third statement again creates
a variable named sum, which will store the summation of x and y value. Finally, the output is printed
is printed on the screen.

Translating HLL into machine language

Computers understand only machine language, so convert the HLL into machine language code by
using language translators known as compiler or interpreters.

CompilerA compiler translates a program into another program, known as target language .

Interpreter An interpreter translates a statement in a program and executes the statement


immediately, before translating the next source language statement.

4. Fourth generation

Fourth generation languages(4GLs) have simple, English- like syntax rules,commonly used to access
databases. The 3GLs are considered as procedural languages because the programmer must list each
step and must use logical control structures to indicate the order in which instructions are to be
executed. 4GLs are non-procedural languages. The non procedural method is simply to state the
needed output instead of specifying each step one after another to perform a task. The computer is
instructed what it must do rather than how a computer must perform a task.

The non-procedural method is easier to write, but has less control over how each task is actually
performed. The 4 GLs are divided into query languages, report generators and application
generators.

5. Fifth generation : very high-level languages

The programmersmay simply type the instructions or simply tell the computers by way of micro-
phones what it needs to do. These languages will be able to process natural languages.The
computers would be able to accept, interpret and execute instructions in the native or natural
language of the end user.

LANGUAGE TRANSLATOR PROGRAMS

These are programs that translate programs written in other languages into a machine language
instructions code, which the computer can execute. There is also a program that can help a
programmer to write his program by providing creation and editing facilities.
Translation programs are known by various names:

i) Assemblers: An assembler translates the symbolic instruction code of programs written in


assembly language into machine code .

ii) Interpreter: An interpreter translates and executes each program statement, one at a time, instead
of producing a complete machine language program, like assemblers and compilers do.

With an interpreter, the source program is not assembled into an object program. The results are
computed immediately after an instruction has been translated. This process allows very efficient use
of computer and programmer time during the debugging of the application.

The interpreter need not be a software program which is loaded from external sources. It may be
permanently residing in a ROM program. Microsoft BASIC interpreter uses such a program. Some
of the Interpretive languages are BASIC, LISP, FORTH, APLetc.

iii) Compilers: A compiler is a program which produces a machine level program from the
specifications of a high level language, by generating one or more than one machine instruction for
each high level instruction, i.e. it translates the higher level program into machine code.

FEATURES OF A GOOD PROGRAMMING LANGUAGE

1. Ease of use : The language should be easy in writing codes for the program and executing them.
Simplicity helps in the readability of the language.
2. Portability: The language should support the construction of code in a way that it could be
distributed across multiple platforms (OS).
3. Generality: Most high-level languages allow the writing of a wide variety of programs, thus
relieving the programmer of the need to become expert in many diverse languages.
4. Brevity: Language should have the ability to implement the algorithm with less amount of code.
5. Error checking: Being human, a programmer is likely to make many mistakes in the
development of a computer program. Many high-level languages enforce a great deal of error
checking both at compile-time and at run-time.
6. Cost: It includes several costs such as Program execution and translation cost, program creation,
testing and usage cost, program maintenance cost.
7. Familiar notation: A language should have familiar notation, so it can be understood by most of
the programmers.
8. Quick translation: It should admit quick translation.
9. Reusability: Code is reusable when it independent of other codes.
10. Modularity: It is desirable that programs can be developed in the language as a collection of
separately compiled modules, with appropriate mechanisms for ensuring self-consistency between
these modules.
11. Widely available: Language should be widely available and it should be possible to provide
translators for all the major machines and for all the major operating systems.
12. Performance :Now a day’s hardware has become quite fast. Hence the application developed
using a good language should tap the maximum resources of the available hardware power in terms
of speed and memory efficiency.
3. ALGORITHM

Algorithm is an ordered sequence of finite, well defined, unambiguous instructions for


completing a task. 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 complete 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.
For ex. There are two simple algorithms to find the greatest among 3
numbers. Algorithm 1.
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.

Algorithm 2.
Step 7: Start
Step 8: Read the three numbers A, B, C
Step 9: Compare A and B. If A is greater, store A in MAX, else
store B in MAX
Step 10: Compare MAX and C. If MAX is greater, output “MAX
is greatest” else output “C is greatest”.
Step 11: Stop

5.2 FLOWCHART
A flowchart is a diagrammatic representation of an algorithm in which the steps are
drawn in the form of different shapes of boxes and logical flow is indicated by
interconnecting arrows. The boxes represent operations and the arrows represent the
sequence in which the operations are implemented. The primary purpose of the
flowchart is to help the programmer in understanding the logic of the program.
Flowchart symbols: Some standard symbols that are required for flowcharts are shown
in table.
Symbol Symbol Name Description
Flow lines Flow lines are used to connect symbols. These lines
indicate the sequence of steps and the direction of
flow.
Terminal This symbol is used to represent the
beginning (start), the termination (end) or halt in the
program logic.
Input / output It represents information entering or leaving the
system, such as customer order(input)
and servicing (output)

Processing Process symbol is used for representing arithmetic and


data movement instructions.
It can represent a single step or an entire sub
process within a larger process.
Decision Decision symbol denoted a decision to be made. The
program should continue along one of the two routes.
(if /else) This symbol as one entry and two exit path.
the path chosen depends on whether the answer to a
question is yes or no.

Connector Connector symbol is used to join different flow lines.


Benefits of flowchart:
The reasons for using flowcharts as a problem solving tool are given below:
Makes Logic Clear: The main advantage of using a flowchart to plan a task is that it provides a
pictorial representation of the task, which makes the logic easier to follow.

Effective Analysis: With the help of a flowchart, the problem can be analyses in an effective
way. This is because the analyzing duties of the programmers can be delegated to other
persons, who may or may not know the programming techniques, as they have a broad idea
about the logic.

Useful in Coding: Once the flowcharts are ready, the programmers can plan the coding process
effectively as they know where to begin and where to end, making sure that no steps are
omitted.

Proper Testing and Debugging: A flowchart helps in detecting the errors in a program, as the
developers know exactly what the logic should do. Developers can test various data for a
process.

Appropriate Documentation: Flowcharts serve as a good program documentation tool.


They can take the help of the program documentation to know what the program actually
does and how to use the program.

Limitations Some of the limitations of the flowchart are given below.

Complex: The major disadvantage in using flowcharts is that when a program is very large, the
flowcharts may continue for many pages, making them hard to follow.

Costly: If flowcharts are to be drawn for a huge application, the time and the cost factor of
program development may get out of proportion, making it a costly.

Difficult to Modify: Any changes or modification to a flowchart usually requires


redrawing the entire logic again, and redrawing a complex flowchart is not a
simple task.

No Update: Usually programs are updated regularly. However, the corresponding update
of flowcharts may not take place, especially in the case of large programs.
PSEUDOCODE

Pseudocode is a kind of structured English for describing algorithms. It allows the designer to focus
on the logic of the algorithm without being distracted by details of language syntax. At the same
time, the Pseudocode needs to be complete. It describes the entire logic of the algorithm so that
implementation becomes a rote mechanical task of translating line by line into source code.

In general the vocabulary used in the Pseudocode should be the vocabulary of the problem domain,
not of the implementation domain. The Pseudocode is a narrative for someone who knows the
requirements (problem domain) and is trying to learn how the solution is organized.

Each textbook and each individual designer may have their own personal style of

Pseudocode. Pseudocode is not a rigorous notation, since it is read by other people, not the
computer. There is no universal "standard" for the industry, but for instructional purposes it is
helpful if we all follow a similar style. The format below is recommended for expressing your
solutions in our class.

Pseudocode uses the pattern of structured English. The basic constructs for flow of control are as
follows:

l SEQUENCE is a linear progression where one task is performed sequentially after another.

l WHILE is a loop (repetition) with a simple conditional test at its beginning.

l IF-THEN-ELSE is a decision (selection) in which a choice is made between two alternative courses
of action.

l REPEAT-UNTILis a loop with a simple conditional test at the bottom.

l CASE is a multiway branch (decision) based on the value of an expression.

CASE is a generalization of IF-THEN-ELSE.

l FOR is a "counting" loop.

l SEQUENCE

Here is an example to illustrate these constructs.

READ height of rectangle

READ width of rectangle

COMPUTE area as height times width

Here the common Action Keywords are as follows.


Input: READ, OBTAIN, GET

Output: PRINT, DISPLAY, SHOW

Compute: COMPUTE, CALCULATE, DETERMINE

Initialize: SET, INIT

Add one: INCREMENT, BUMP

l IF-THEN-ELSE

The general form of this structure is

IF condition THEN

sequence 1

ELSE

sequence 2

ENDIF

The ELSE keyword and "sequence 2" are optional. If the condition is true then sequence 1 is
performed, otherwise sequence 2 is performed. For example

IF HoursWorked > NormalMax THEN

Display overtime message

ELSE

Display regular time message

ENDIF

l WHILE

The general form of this structure is

WHILE condition 1

sequence 1

ENDWHILE

The loop is entered only if the “condition 1” is true. The "sequence 1" is performed on every
iteration. At the conclusion of each iteration, the condition is evaluated and the loop continues as
long as the condition is true. For example
WHILE Population < Limit

Compute Population as Population + Births - Deaths

ENDWHILE

CASE

There are four keywords, CASE, OF, OTHERS, and ENDCASE, and conditions

that are used to indicate the various alternatives. The general form is:

CASE expression OF

condition 1 : sequence 1

condition 2 : sequence 2

...

condition n : sequence n

OTHERS:

default sequence

ENDCASE

The OTHERS clause with its default sequence is optional. Conditions are normally numbers or
characters indicating the value of "expression", but they can be English statements or some other
notation that specifies the condition under which the given sequence is to be performed. A certain
sequence may be associated with more than one condition.

Example

CASE Title OF

Mr. : Print "Mister"

Mrs. : Print "Missus"

Miss. : Print "Miss"

Ms. : Print "Mizz"

Dr. : Print "Doctor"

ENDCASE

Example
CASE grade OF

A : points = 4

B : points = 3

C : points = 2

D : points = 1

F : points = 0

ENDCASE

l REPEAT-UNTIL

Two keywords, REPEAT and UNTILare used. The general form is:

REPEAT

sequence 1

UNTILcondition 1

The "sequence 1" in this type of loop is always performed at least once, because the test is performed
after the sequence is executed. At the conclusion of each iteration, the “condition 1” is evaluated,
and the loop repeats if the “condition 1” is false. The loop terminates when the “condition 1”
becomes true.

l FOR

This loop is a specialized construct for iterating a specific number of times, often called a "counting"
loop. Two keywords, FOR and ENDFOR are used. The general form is:

FOR iteration bounds

sequence

ENDFOR

In cases where the loop constraints can be obviously inferred it is best to describe the loop using
problem domain vocabulary. For example

FOR each month of the year (good)

FOR month = 1 to 12 (ok)

FOR each employee in the list (good)

FOR empno = 1 to listsize (ok)


l NESTED CONSTRUCTS

The constructs can be embedded within each other, and this is made clear by use of indenting.
Nested constructs should be clearly indented from their surrounding constructs.

For example

SET total to zero

REPEAT

READ Temperature

IF Temperature > Freezing THEN

INCREMENT total

END IF

UNTILTemperature < zero

Print total

In the above example, the IF construct is nested within the REPEAT construct, and therefore is
indented.

Advantages of Pseudocode

Preparing pseudocode while solving any problem through computer has following advantages :

It allows the designer to focus on main logic without being distracted by programming languages
syntax.

Since it is language independent, it can be translated to any computer language code.

It allows designer to express logic in plain natural language.

It is easier to write actual code using pseudocode.

Unlike algorithms, pseudocodes are concise so pseudocodes are more readable and easier to modify.

Disdvantages of Pseudocode

Pseudocode has following disadvantages :


There are no accepted standards for writing pseudocodes and designer use their own style while
writing pseudocodes.

Pseudocode cannot be compiled and executed so its correctness cannot be verified by using
computers.

You might also like