Algorithm And Flowchart

¡Supera tus tareas y exámenes ahora con Quizwiz!

Consider the following flowchart. What value will it display? a) 1 c) 2 b) 3 d) No value is displayed

d

Flowchart

is a graphical representation of steps of an algorithm . It is a set of different types of boxes and symbols that are connected with arrows / flow lines.

A variable

is the name of data . It keeps on changing its value during execution of a program.Its value can be incremented or decremented as per your requirement .

The steps for baking a cake are mixed up. Rearrange the following steps to write an algorithm for baking a cake. (a) Pour the mixture in a baking pan. (b) Cool the cake and cut into pieces (c) Collect all the ingredients. (d) Preheat the oven to 325O F. (e) Take the cake out of the oven (f) Bake the cake in the oven (g) Mix the ingredients in a bowl. (h) Check the cake. If required, bake it again for five more minutes

a- 4 b-8 c-1 d-2 e-7 f-5 g-3 h-6

Connector

It connects one part of flow chart to another .

Diagram Canvas

It is the largest blank area where you can draw the desired diagrams .

Standard toolbar

It provides quick tools like new , open , save ,print , and export diagram etc.

Write any one limitation and one feature of flowchart.

Limitation- Alternation Feature- Uses different shapes

Dia interface

Menu Bar- Standard toolbar- Diagram Canvas - Toolbox .

Write an algorithm to find the area of a square

1- Find the length of the square 2- Find the width of the square 3- Multiple the width by the length

Advantages of flowchart

1- Flowcharts are an easier way to depict the logic of the program . 2- Flowcharts , being graphical , help greatly in proplem analysis. 3-Flowcharts of any program are good for documentation and later reference . 4- A flowchart helps in debugging process ( to remove errors).

Limitation of Flowchart:

1- For example , large programs flowchart becomes complex and difficult to follow. 2- If alterations are required the flowchart may require re-drawing completely.

To find the area of a rectangle

1- Start. 2- Input the length and breadth of the rectangle ; L,B. 3-Calculate the area ;Area=L*B. 4-Print the Area. 5-Stop.

To find the greater of two numbers:

1- Start. 2-Input two numbers , X and Y. 3- Compare X and Y .If both are equal , go to step 5, else go to step 4. 4- Compare if X is greater , go to step 6,else go to step 7. 5- Print " Both are equal"and go step 8. 6-Print "X is greater" and go to step 8 . 7- Print "Y is greater"and go to step 8. 8- Stop.

Editing Tools

1- Use Arrow tool to move the shape around on the canvas . 2-Use Text edit tool to type text inside the block or press F2 key on the keyboard. 3-Use Connecters to connect the blocks with lines and arrows. 4- Use Line widths to set the line thickness. 5- Use Arrow styles to set desired arrow style. 6- For font, lines and colour settings , double click on the desired block to edit its properties . You can use File menu > Export options to export your chart as an image.

To calculate the sum of three numbers

1- start 2- Input three number ; x, y and z. 3-Calculate the sum of three numbers (x+y+z) 4-Print the sum. 5- Stop.

Advantages of Algorithm

1-It is the set of steps arranged in a logical sequence as a solution to a given problem. 2-it makes it easier to create the graphical representation of the program flow called flowchart. 3-It is in human language (English in our case) hence easy to understand . 3-It is easy to find logical errors since every step has its own logical sequence .

What will be displayed if the first number is 5 and the second number is 2 in flowchart ?

10,4

Decision Box

A decision /diamond box checks any condition in the program.

Loop

A loop has a purpose to repeat one or more statements a certain number of times or until a condition is fulfilled . While using a loop , you need a counter . A counter is a variable that is used to count the number of times a procedure is being repeated . Its name could be anything like X , counter , ctr etc.

Input/Output Box

A parallelogram represents input or output.

Process Box

A rectangle represents a process.

Menu Bar

A standard menu bar with various menus.

Toolbox .

All the blocks and connecters you need are available in the Toolbox . It also provides options for line widths and arrow styles.

Correct the following statements: a) Algorithm means a set of rules which specify how to solve some problems b) Connectors are used to show the break of the flowchart from one box to another c) SmartDraw is a special software to write algorithm d) The General direction of flow in any flowchart is from bottom to top or right to left

An algorithm is a sequence of instructions, typically used to solve a class of specific problems or to perform a comput Connectors are used to show the beginning or end of a flowchart. Smart Draw is a special software to write flowcharts. The General direction of flow in any flowchart is from top to bottom or left to right

Start/Stop Box

An oval represents the start or end point .

Drawing Flowcharts in Dia

Click on the desire block in the Toolbox and drag with mouse on the Canvas.The block will be drawn.

Why should we write algorithms or flowcharts before writing a program?

Flow chart and algorithm make your program understandable, and it helps you write your program.

Converting an Algorithm into a flowchart

Flowcharts are usually drawn from top to bottom.To convert an algorithm into a flow chart , pick up each statement in the algorithm and find the suitable , matching block of flowchart . Then connect them from top to bottom or left to right as the space on the paper allows .

Define Program

Set of instructions that a computer can run.

Flow lines

The flow lines determine the flow through the chart i.e they show the direction in which the program moves .

Algorithm

The logical sequence of steps for a program and it is written in simple English .it helps in understanding the flow of the intended program easily .Another Advantage of algorithm is to use it to developits graphical form called flowchart .


Conjuntos de estudio relacionados

HS 10: Enlightenment/enlightened despotism

View Set

AP World History: Reading Quiz (pgs. 50-72)

View Set

Entire Audit Set - Just one answer

View Set

Unit 17 Human Rights and Fair Housing

View Set

Sat Reading type questions/strategies

View Set

Writing Process & Unit Assignment

View Set