Stacy+Walker

Study Question 4 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. The major symbols are the DECISION (also known as selection) and the SEQUENCE (or process) symbols. The START and STOP symbols are called the terminals. The SUBPROCESS symbol is a variation on the sequence symbol. There are also connectors drawn between the symbols and you will see these used in the examples below.

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.

25. Use //subprocesses// in flow charts. A subprocess flow chart can contain other subprocesses, there is no limit to how deeply these could be nested. Subprocesses are also useful in dealing with the flow charting rule that a flow chart should have no more than 15 or so symbols on a page.

26. Use nested conditionals in flow charts.

27. Use //nested loops// in flow charts. The nested while loop in the example from the reading assignment. This example is much simplified, it doesn't show any initialisation of either of the loops, the outer loop doesn't do any processing apart from the processing the inner loop, neither loop shows any statements which will lead to the termination of the loops. 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.

Study Question 5 28. Describe and use nested loops. A nested loop sits inside another loop.

29. Describe and use compound statements. There is no obvious difference except that the code on the right uses indentation and the indentation is meant to show that the statements //y = x + 7//, //z = y + 2// and j = z + 9 will only execute if //x = = 22// is true. This kind of arrangement of statements is called a //compound// statement.

30. Use indentation to show program structure.

31. List and describe the different kinds of errors that can occur in programs. Type Compile Error, Expecting End Brace, Expecting Right Brace

32. Apply techniques which minimize the impact of errors.

33. Describe what is meant by a sentinel variable. A sentinel or guard value is a value which is used to terminate a loop

34. Use sentinel variables in repeat loops. A variable that bumps you out of the loop.

35. Describe and use priming in while loops.

36. Use multi-way selection (nested decisions). If and If....else,

Study Question 6 37. What is a function? A powerful feature of action script that make it possible to reuse blocks of code throughout a flash movie in great flexiblity.

38. What are the benefits of using functions? Functions allow for neater organization of code, and keep you from having to rewrite sections of code, over and over again.

39. Define the term parameter / argument. In [|computer programming], a **parameter** is a special kind of [|variable], used in a [|subroutine] to refer to one of the pieces of data provided as input to the subroutine.[| These pieces of data are called **arguments**.]

40. What is meant by event-driven programming? [|It is a programming paradigm] in which the [|flow of the program] is determined by [|events].

41. What is an event handler? A synchronous [|callback] subroutine that handles inputs received in a program

42. How are event handlers used? Instead of just having a line of code, we attach an event that you have to dispatch and listen for.

43. What is an event listener? The standard way an event is called to action.

Study Question 7 44. Why are classes described as the “blueprint” for program objects? Because classes are what is used to create the objects.

45. What is the difference between a class and an instance? A class is the instructions on what the object is going to do. An instance is the physical representation of the object.

46. What programming structures do classes contain? Functions and Variables (properties and methods)

47. Why do programmers create //**classes**//? To group functions and variables.

48. Describe the purpose of a //**constructor function**//. Its the function that constructs the instance of the object.

49. Once you create a custom class, how do you use it? You can create a super class to do certain things and you can extend that class to make it do certain other things. You can also override classes.

50. What is the classPath? If you have a library, the class path is the path to find the folder you are looking for. Its what Flash uses to find your files.

51. Define the terms instantiation, polymorphism, and encapsulation. Instantiaion is to provide an instance of or concrete evidence in support of (a theory, concept, claim, or the like). Properties that are not externally accessible are //encapsulated// by their class.

Study Questions 3

17. What is **//pseudocode//**? //Pseudocode//, like step-form, is a written way of stating algorithms but uses a much more restricted vocabulary. It is very much like a 3GL and for many programmers and program designers is the preferred way to state algorithms and program specifications. //Pseudocode// is a written statement of an algorithm using a restricted and well-defined vocabulary.

18. List the pseudocode statements for input, output, iterate, decision, and processing __Input:__ READ; __Output:__ DISPLAY; __Iterate:__ REPEAT statement UNTIL ; DOWHILE statement END DOWHILE; FOR = to ENDFOR __Decision:__ IF THEN statement ENDIF; IF THEN statement ELSE statement ENDIF __Processing:__ ADD, SUBTRACT, COMPUTE, SET

19. Use math, relational, and logical operators in pseudo-code.

-count = count + 22 -count = 51 If count <= 50 THEN DISPLAY 'count is less than 51' ENDIF If count > 50 THEN DISPLAY 'count is greater than 50' ENDIF -IF (x ==32) AND (y==7) THEN sumxy = x+y

20. Use subprocess/subroutines/functions in pseudo-code.

Drive the car to the gas station. Determine if the tank is on the left or right side of the car. Park your car next to the gas pump with the tank on the same side as the pump. If the protective cover can't be pulled open manually, locate the tank door button inside the car and pop the door with the button. Exit vehicle and go to the pump. Remove the gas cap from the car. Remove the pump from the pump holder and insert nozzle into vehicle gas tank. Turn pump on and pull the handle on the pump upwards to start the flow of gas. Hold handle up to fill the tank with gas. Dispensing will stop when the tank is full. Release handle. When pump shuts off, remove the pump from the vehicle and return it to the pump holder. Replace the cap on the car tank and close the little door.
 * //Algorithm for pumping your gas://**

Study Questions 2

1) What is an **//algorithm//** ? An effective procedure for solving a problem in a certain number of steps

The sequence (or process), the decision (or selection), and the repetition (also known as looping)
3) //**Sequence**// means that each step or process in the algorithm is executed in the specified order. 4) The //**Decision**// constructs - If ... then, If ... then ... else ...

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
5) The //**Repetition**// constructs - Repeat and While...Repetition takes two forms, the Repeat loop and the While loop.

The repeat loop is used to iterate or repeat a process or sequence of processes until some condition becomes true.
6) Describe different ways of stating algorithms: Step-Form, Pseudocode, Flowchart, Nassi-Schneiderman 7) Explain what is meant by the term "variable". The //variable// is a container for a value which may vary during the execution of the program. 8) Explain what is meant by "variable data types". Types of data can differ in they can be numerical, alphabetical characters, or logical data (true/false)

9) Describe some variables in your own life. Bank Account, Physical Health

13) Sketch and briefly explain the software development life cycle.

=
During //phase one// the emphasis is on fact-gathering and determining where the boundaries of the problem are. //Phase two// involves the steps of identifying the variables and processes which make up the problem. //Phase 3// is where you will use the tools and techniques that you learn in this module. During this phase the strategies which will solve the problem are developed. //Phase 4// represents the time when the solution to the problem, the programs or system, is constructed. //Phase 5// is a critical time but can be minimized if the previous steps are correct. //Phase 6//, the maintenance phase, is the time when the solution is in active use. It may undergo enhancements or it may have bugs fixed during its lifetime.======

14) Where in the Software Design Life Cycle (SDLC) is the program design activity?
A **software development process** is a structure imposed on the development of a software product. Synonyms include [|software life cycle] and //software process//. There are several [|models] for such processes, each describing approaches to a variety of [|tasks or activities] that take place during the process. 15) Explain what is meant by the terms variable and process. A **process variable** is the current status of a process under control. An example of this would be the temperature of a furnace. 16) Write a step-form algorithm to solve the problem: "Design a program which counts all the pages of a given book." **See algorithm for pumping gas above.**