(IX) Ch-13 Program Development Cycle

1. Fill in the blanks: (a) proper planning and its implementation (b) problem analysis (c) algorithm and flowchart (d) bugs (e) decision (f) condition (g) algorithm (h) Loop 2. State true or false: (a) True (b) True (c) True (d) True (e) True (f) True 3. Answer the following questions in short: a. Which is the first step in software development life cycle? Answer: Analyze the problem b. What is pseudo code? Answer: Pseudo code is another method of organizing a program or program designing tool. It is not a real program but it gives models and even looks like a programming code. c. What do you mean by coding a program? Answer: Coding a program means writing a program in a computer. d. What is syntax error? Answer: Errors occur due to the violation of rules of the statement structure, which may be caused by misspelling of the keyword or due to the incorrect format of the statement. e. What is logical error? Answer: Logical error is those error occurs in the program due to the fault designing, fault analysis, wrong formulas etc. f. What is the pre-test loop structure? Answer: The loop srtucture that checks the condition and executes statements of loop is called pre-test loop. 4. Answer the following questions: a. Define the term "program development cycle". Mention its steps with a figure. Answer: The program development cycle is a set of steps or phases that are used to develop a program in any programming.
b. What is problem analysis? Why is it important in programming development? Answer: The first and very important step of the program development cycle in which the developer should think about the input data, logical processes and required output from the given data. It is important in programming because until the problem is not clear, the desired solution is not obtained. c. Define program designing tools. Explain them in brief with one example of each. Answer: The tools used to plan the program before writing codes to the computer to avoid errors in computer program is called program designing tools. Some of the program designing tools are:- (1) Flowchart : A diagrammatic representation of the steps involved in solving a problem. It is pictorial representation, which uses the predefined symbols to represent the logic, data and processing step of a program. Examples of flowchart: To find the sum of two numbers
(2) Algorithm: Algorithm can be defined as a sequence of instructions designed in a manner that, if the instructions are executed in the specified sequence, the desired results will be obtained. Examples of Algorithm: An algorithm to read two numbers M and N, add them and print the result. Step 1: Start Step 2: Read values of two numbers M and N Step 3: Add M and N Step 4: Print the sum of M and N Step 5: Stop d. What is documentation? Write its importance. Answer: Documentation refers to the written material of a program which include flowchart, algorithm, source code and other manuals of computer program. It is important because it helps the user to understand the use of program and are also useful for the programmers for the maintenance and redesigning of the program. e. Draw standard symbols of a flowchart with their meaning. Answer:
f. Define algorithm. Write the properties of an algorithm. Answer: An algorithm is a programming tool that is used to develop a program solving logic. The properties of algorithm are as follow: 1. The steps mentioned in an algorithm should be executable by the computer. 2. It should not have any doubt about the execution of the next statement. 3. The steps of an algorithm should be finite. 4. It should not depend on a particular computer language. 5. After a finite number of steps, it should be concluded. g. What is pseudo code? Give one example of it. Answer: Answer: Pseudo code is another method of organizing a program or program designing tool. It is not a real program but it gives models and even looks like a programming code. Pseudo code to find greater number among two number READ A and B IF A is greater than B then Print "A is greater" ELSE Print "B is greater" END IF STOP h. What are the three different structures of a program? Explain them with examples. Answer: The three different structures of a program are as follows: i. Sequential structure ii.Selection structure iii.Looping structure i. Sequential structure A sequential execution is a logic that executes statements sequentially that is one after another or from top to bottom. Example of sequential structure is as follows: Flowchart to find area of rectangle
ii. Selection structure A selection structure is a logic that depends upon a condition and makes a choice between two alternative paths. If the condition is true,it follows the path of the true side.Otherwise, it follows the path of false side. The following structure shows a selection structure :

Flowchart to test whether the given number is "Even" or "Odd"


iii.Looping structure A loop structure is a logic that is used to execute statement blocks for a number of times without recording them. a loop structure may have pre-test loop structure or post-test loop structure. The following structure shows the loop structure logics. Flowchart to multiplication table of a number i. Define flowchart. Write its advantages and disadvantages. Answer: A graphical representation of the steps involved in solving a problem is called as flowchart. Its advantages:- (a) A flowchart is a pictorial representation of the flow of operations. Hence, any errors occuring in the logic can be easily detected. (b) It is an effective communication tool. It is convenient to explain the logic of the flowchart itself, rather than the program. (c) It is very helpful in case of modification of the program in the future. (d) While writing a big problem, different programmers are involved to draw different parts of the flowchart. After the completion of the flowcharts, the programmers sit together and visualize the overall system. (e) Once the flowchart is complete, it acts as a guideline and makes easy to write the program. Its disadvantages:- (a) It is time consuming task. (b) Programs can be modified but it is not possible to modify the flowchart. It should be redrawn, which becomes costly. (c) When there are complex branches and loops, the flowchart becomes more complicated. j. Logical errors are difficult to find and correct. Express your views. Answer: Logical errors may occur in the program due to the fault designing,fault analysis, wrong formulae etc. These errors are difficult to find because language translators cannot detect logical errors and do not produce any error messages. The program may run successfully in presence of logical errors, but they produce a wrong result. k. What is post test loop? Draw a flowchart of it. Answer: Post test loop structure checks the condition after executing statements of loop once. do while loop flowchart l. Write the difference between pre-test and post-test loop structure. Answer:
Pre Test LoopPost Test Loop
1. It checks the condition before execution of statement.1. It executes the statement at first then only checks the condition.
2. Example: for-next loop and while-wend loop2. Example: do- loop while
5. Write algorithms and draw flowcharts for the following: a. Find sum and average of any two input numbers Algorithm to find sum and average of two numbers Step 1: Start Step 2: Input two numbers as a and b Step 3: sum=a+b and average=sum/2 Step 4: Print sum and average Step 5: Stop Flowchart to find sum and average of two numbers
b. Read two different numbers then find sum, difference and product of numbers Algorithm to calculate the sum, difference and product of any two numbers Step 1: Start Step 2: Input two numbers as num1 and num2 Step 3: sum=num1+num2 , difference=num1-num2 and product=num1*num2 Step 4: Print sum, difference and product Step 5: Stop
c. Find the area of a rectangle where area=(L*B) Algorithm to find the area of rectangle where A=L*B Step 1: Start Step 2: Input length and breadth as L and B Step 3: area = L*B Step 4: Print area Step 5: Stop

Flowchart to find the area of rectangle where A=L*B


d. Print the area of four walls where A=2H(L+B) Algorithm to find the area of four walls where A=2H(L+B) Step 1: Start Step 2: Input length , breadth and height as L , B and H Step 3: area = 2*H*(L+B) Step 4: Print area Step 5: Stop

Flowchart to Print the area of four walls


e. To input a number and check whether the input number is even or odd Algorithm to test whether the given number is "Even" or "Odd" Step 1: Start Step 2: Input any number as num Step 3: Find remainder(R) of num divided by 2. Step 4: Is R equal to zero? 4.1: If true, Print "Even" 4.2: If false, Print "Odd" Step 5: Stop

Flowchart to test whether the given number is "Even" or "Odd"


f. To input a number and check whether the input number is fully divisible by 3 or not Algorithm to test whether the input number is divisible by 3 or not Step 1: Start Step 2: Input any number N Step 3: Check the remainder of N divided by 3 Step 4: Print divisible, If remainder is 0 , otherwise display not divisible Step 5: Stop

Flowchart to test whether the input number is divisible by 3 or not


g. To print first ten odd numbers Algorithm to print first ten odd numbers Step 1: Start Step 2: Initialize I=1, A=1 Step 3: Is I<=10? 3.1: If true, Print A, Calculate A=A+2 and go to step 4 3.2: If false, go to step 5 Step 4: Calculate I=I+1 and go to step 3 Step 5: Stop Flowchart to print first ten odd numbers
h. To print all even numbers from 100 to 2 Algorithm to print all even numbers from 100 to 2 Step 1:Start Step 2:Set P= 100 Step 3: Check P > = 2 If yes, then display I If no, then goto 5 Step 4: Set P = P - 2, then goto step 3 Step 5: Stop

Flowchart to print all even numbers from 100 to 2


i. To print all odd numbers from 1 to 99 and find their sum Algorithm to print all odd numbers from 1 to 99 with their sum Step 1: Start Step 2: Initialize A=1,Sum=0 Step 3: Is A <=99? 3.1: If true, Print A , Sum=Sum+A and go to step 4 3.2: If false, go to step 5 Step 4: Calculate A=A+2 and go to step 3 Step 5: Print Sum Step 6: Stop Flowchart to print all odd numbers from 1 to 99 with their sum
j. To print series 1,4,9,16 upto 10thterms Algorithm to print series 1,4,9,16 upto 10thterms Step 1: Start Step 2: Set A = 1 Step 3 : Check A <=10? 3.1 If yes, print A*A and goto step 4 3.2 If no, goto stop Step 4 : A=A+1 and goto step 3 Step 5: Stop Flowchart to print series 1,4,9,16 upto 10thterms