Friday, November 6, 2009

Due Saturday, October 31

21. Describe what is meant by a program flow chart.

Flow charts are a graphical method of designing programs and once the rules are learned are very easy to draw. A well-drawn flow chart is also very easy to read since it basically uses just two symbols, two decision constructs. and two iteration constructs

22. Sketch and label the symbols and constructs used in flow charts.


http://users.evtek.fi/~jaanah/IntroC/DBeech/images/3gl_flow_symbols.gif
http://users.evtek.fi/~jaanah/IntroC/DBeech/images/3gl_repeat.gif



23. State the guidelines for drawing flow charts.


1. Every flow chart has a START symbol and a STOP symbol
2. The flow of sequence is generally from the top of the page to the bottom of the page. This can vary with loops which need to flow back to an entry point.
3. Use arrow-heads on connectors where flow direction may not be obvious.
4. There is only one flow chart per page
5. A page should have a page number and a title
6. A flow chart on one page should not break and jump to another page
7. A flow chart should have no more than around 15 symbols (not including START and STOP)


24. Design a program using a flow chart.

The algorithm sums all the even numbers between 1 and 20 inclusive and then displays the sum. It uses a repeat loop and contains a null else within the repeat loop.

The equivalent pseudocode is:

sum = 0
count = 1
REPEAT
IF count is even THEN sum = sum + count
count = count + 1
UNTIL count > 20
DISPLAY sum






25. Use subprocesses in flow charts.
The subprocess is useful because:

* it provides a means of simplifying programs by making common processes available to a wide number of programs.
* it permits the modularisation of complex programs.
* it makes for more reliable programs since once it is shown that a process works then it can be made a subprocess and need not be tested again.


26. Use nested conditionals in flow charts.

http://users.evtek.fi/~jaanah/IntroC/DBeech/images/3gl_flow_nest2.gif



27. Use nested loops in flow charts

Each single step through the outer loop will lead to the complete iteration
of the innner loop. Assume that the outre loop counts through 10 steps and the inner loop through 100 steps. The sequence in the inner loop will be executed 10 * 100 times. Nested loops will do a lot of work.

No comments:

Post a Comment