Friday, November 6, 2009

study questions 1

IMD230 William's study questions

1. )The algorithm is part of the blueprint or plan for the computer program. An effective procedure for solving a problem in a finite number of steps.
2. Algorithms show these three features:

1. Sequence (also known as Process)
2. Decision (also known as Selection)
3. Repetition (also known as Iteration or Looping)

3.)Sequence means that each step or process in the algorithm is executed in the specified order. In the example algorithm above each process must be in the correct place otherwise the algorithm will most probably fail.
4.)In algorithms the outcome of a decision is either true or false, there is no in between. The outcome of the decision is based on some condition that can only result in a true or false value, for example:
5.)The repeat loop is used to iterate or repeat a process or sequence of processes until some condition becomes true. It has the general form:The repeat loop does some processing before testing the state of the proposition, what happens though if in the example above the kettle is already full? If the kettle was already full at the start of the repeat loop then putting more water in will lead to an overflow.
6.) 1. Step-Form
2. Pseudocode
3. Flowchart
4. Nassi-Schneiderman
7.)Just about every algorithm contains data and usually the data is "contained" in a thing called a variable. The variable is a container for a value which may vary during the execution of the program. For example, in our tea-making algorithm the level of water in the kettle is variable, the temperature of the water is variable, the quantity of tea leaves is also variable.
8.)If the kettle does not contain water then fill the kettle.
If Water_Level is 0 then fill the kettle
9.)The data used in algorithms can be of different types. The simplest types of data that an algorithm might use are:
10.)* numeric data like 12, 11.45, 901.
  • alphabetic or character data like 'A', 'Z' or 'This is alphabetic'.
  • logical data, that is propositions with true/false values.
11.)It is a good idea to adopt a conventional way of naming variables.don't hide the meaning of the original phrase.words belong together and represent a variable
12.)Step 1: Investigation step,Step 2: Preliminary algorithm step,Step 3: Refining the algorithm step
13.)computer programs, aka software, and software systems, collections of softwares, have quite well-defined life cycles,The need for a program is recognised, the requirements are analysed, a possible solution is designed, the prototype is built and tested, and finally the program is put into use. Figure 1 shows the typical life-cycle for a computer program.
14.)There is a strong connection between phases 2 and 3 since the process of designing a solution to a problem is an iterative process and often involves a great deal of discovery.
15.)A variable is something whose value will change over time. For example daily temperature is a variable. If you measure the room temperature now and measure it one hour from now there is every chance that the two measurements will give different values. In this example the word temperature represents a variable.process is an activity which, in computing terms, transforms data. In general terms a process is an activity which involves some steps designed to achieve a particular outcome. Processes take data, the contents or values of variables, and transform it.
16.)The process of making a sandwich


William Eddy
Algorithm to making a sandwich
1. identify what a sandwich is
2. identify the Peanut Butter
3. identify the Jelly
4. identify the bread
5. direct attention to opening both Peanut butter and Jelly
6. receive knife from drawer
7. spread peanut butter on one slice of bread
8. spread Jelly on other slice of bread
9. put knife in the sink, to be cleaned
10. close peanut butter jar and put back in cabinet
11. close Jelly jar and put back in cabinet
12. put both slices of bread together making a PB-n-J

No comments:

Post a Comment