IP Unit1 Essay Questions
IP Unit1 Essay Questions
1. Oval: Rectangle with rounded sides is used to indicate either START/ STOP of the program.
2. Input and output indicators: Parallelograms are used to represent input and output operations.
Statements like INPUT, READ and PRINT are represented in these parallelograms.
3. Process Indicators: Rectangle is used to indicate any set of processing operation such as for
storing arithmetic operations.
4. Decision Makers: The diamond is used for indicating the step of decision making and therefore
known as decision box. Decision boxes are used to test the conditions or ask questions and
depending upon the answers, the appropriate actions are taken by the computer.
5. Flow Lines: Flow lines indicate the direction being followed in the flowchart. In a Flowchart,
every line must have an arrow on it to indicate the direction. The arrows may be in any direction.
6. On-Page connectors: Circles are used to join the different parts of a flowchart and these circles
are called on-page connectors. The uses of these connectors give a neat shape to the flowcharts. In
a complicated problem, a flowchart may run into several pages. The parts of the flowchart on
different pages are to be joined with each other. The parts to be joined are indicated by the circle.
7. Off-page connectors: This connector represents a break in the path of flowchart which is too
large to fit on a single page. It is similar to on-page connector. The connector symbol marks where
the algorithm ends on the first page and where it continues on the second.
Example:
The flowchart to compute and display the sum of two numbers is shown below:
5. Develop an algorithm and design a flowchart for calculating the area of a equilateral triangle.
� �
Area of equilateral triangle is computed by formula ���� = �
� , where ‘a’ is length of side of
triangle.
Algorithm:
1. Start
2. Input: Read the side length ‘a’ of the equilateral triangle.
�
3. Calculate the area: ���� = � ��
4. Output: Display the calculated area ‘Area’.
5. Stop
Flowchart:
6. Explain about Top-down approach. Draw a Flow chart for reading student marks in three
subjects and print total and average.
Top Down Design
Once we have defined the problem and have an idea of how to solve it, we can then use the
powerful techniques for designing algorithms. Most of the problems are complex or large
problems and to solve them we have to focus on, to comprehend at one time, a very limited span
of logic or instructions. A technique for algorithm design that tries to accommodate this human
limitation is known as top-down design or stepwise refinement.
Top down design provides the way of handling the logical complexity and detail
encountered in computer algorithm. It allows building solutions to problems in step by step. In
this way, specific and complex details of the implementation are encountered only at the stage
when sufficient groundwork on the overall structure and relationships among the various parts of
the problem.
Before the top down design can be applied to any problem, we must at least have the
outlines of a solution. Sometimes this might demand a lengthy and creative investigation into the
problem while at another time the problem description may in itself provide the necessary starting
point for the top-down design.
Top-down design suggests taking the general statements about the solution one at a time,
and then breaking them down into a more precise subtask / sub-problem. These sub-problems
should more accurately describe how the final goal can be reached. The process of repeatedly
breaking a task down into a subtask and then each subtask into smaller subtasks must continue
until the sub-problem can be implemented as the program statement. With each spitting, it is
essential to define how subproblems interact with each other. In this way, the overall structure of
the solution to the problem can be maintained. Preservation of the overall structure is important
for making the algorithm comprehensible and also for making it possible to prove the correctness
of the solution.
7. Explain about the efficiency of algorithm and write an algorithm to find the greatest of three
numbers.
Efficiency of algorithm:
Every algorithm uses some of the computer’s resources like central processing time and
internal memory to complete its task. Because of high cost of computing resources, it is desirable
to design algorithms that are economical in the use of CPU time and memory. Efficiency
considerations for algorithms are tied in with the design, implementation and analysis of
algorithm. Analysis of algorithms is less obviously necessary, but has several purposes:
Analysis can be more reliable than experimentation. If we experiment, we only know the
behaviour of a program on certain specific test cases, while analysis can give us guarantee
about the performance on all inputs.
It helps one choose among different solutions to problems. As we will see, there can be many
different solutions to the same problem. A careful analysis and comparison can help us decide
which one would be the best for our purpose, without requiring that all be implemented and
tested.
We can predict the performance of a program before we take the time to write code. In a large
project, if we waited until after all the code was written to discover that something runs very
slowly, it could be a major disaster, but if we do the analysis first we have time to discover
speed problems and work around them.
Algorithm to find the greatest of three numbers:
1. Start
2. Read three numbers ‘a’, ‘b’ and ‘c’.
3. If (a >= b && a >= c), print “a is the greatest”.
4. Else if (b >= c), print “b is the greatest”.
5. Else print “c is the greatest”.
6. Stop