CH 1 Programming technique
CH 1 Programming technique
QIII. What is a flowchart? Find out what the problem asks to do.
Flowchart is a diagrammatic representation of algorithm. It describes What information can be obtained from the problem?
what operations are required to solve a given problem.
What is required to be calculated as the solution of the problem?
QIV. What are the advantages of using flowcharts?
Flowchart illustrates the sequence of operations to be performed 2) Analyzing the Problem:
to solve a problem. The programmer investigates the problem and gathers as much
Programmers draw flowcharts before writing computer programs. information as possible to find a solution. The following questions
Flowchart provides an easy way to analyze and find solutions of can be asked to analyze the problem.
problems. Is it possible to solve the problem on a computer?
Once, the flowchart is drawn, it becomes very easy to write the What is to be done to find the solution of the problem?
program in any high level language. What is the proper and what output is required?
Flowchart is very helpful in communicating the problem solving How many solutions are possible?
method to other people. Which solution is the best and why?
It also helps in finding and removing errors in computer programs. How solution will be implemented?
LONG QUESTIONS
3) Planning The Solution Of The Problem:
Q3.Describe the steps involved in problem solving?
It refers to dividing the solution of any problem into steps and
The following five steps are involved in problem solving on computer.
arranging them into proper order.
How to Discuss a Problem:
1) Defining the Problem:
Talk to the right person.
Defining the problem is first stage of problem solving. It’s very
Focus on talking about the problem only.
important to understand the problem before the programmer starts
working on its solution. The following are the steps to properly Stay calm and reasonable.
define and understand the problem. Explain the problem in detail and provide any evidence you may
Carefully read the problem to understand what it tells. have.
PISK COMPUTER SCIENCE GRADE10 3
Tell them what outcome you want. Q5.Write an algorithm that inputs length in inches and calculate
Q8.Write an algorithm to find the product of given numbers. Step 3 Otherwise GOTO Step 6
PRODUCT = 1×3×5×7×9×11×13×15 Step 6 Stop
Step 1 Start
Initialize variable K to 1 and prod = 1 K=1 Prod= 1 Q10. Write an algorithm and draw flow chart to calculate the area
Step 2 Increment K by 2 of a rectangle for given breadth and length.
K=K+2 1. Start
Step 3 Find the Product 2. input l, b for rectangle.
Prod=Prod × K 3. Calculate Area=l*b.
Step 4 Check if the value of K is less than 16 4. Output area.
IF K<16 THEN GOTO Step 2 otherwise GOTO Step 5 5. End
Step 5 Print product
Print Prod
Step 6 Stop
P=1,k=1
P=p*k1,k=k+2
PRINT P
I=10
I=I-1
PISK COMPUTER SCIENCE GRADE10 6
Area of Rhombus
1. Start
2. input diagonals d1, d2 for Rhombus.
3. Calculate R.Area=1/2(d1xd2)
4. Output R.area.
5. End
Area of Trapezium
1. Start
2. input enter length of two
parallel sides A,B.
3. Calculate T. Area=(A*B)*H/2
TO FIND INTEREST
4. Output T.area.
5. End
1. Start
VOLUME OF CYLINDER 2. Input Amount, years and
1. Start
rate
2. Input h and r for cylinder.
3. Calculate
3. Calculate Volume= H*3.14*R2.
interest=amount*year*rate/100
4. Output Volume. 4. Output interst.
5. End
5. End
PISK COMPUTER SCIENCE GRADE10 7
TELL THE NUMBER IS EVEN Q. What is defining in finding average marks of a student?
OR ODD It is clear from the problem statement that average marks of a student
Step 1 Start have to be found. This is numeric problem.
Step 2 Input number Q. What information is required Finding average marks of a student.
Step 3 IF number%2 ==0 To analyze Problem the following information is required.
THEN PRINT What are the subject marks of the student in each subject?
EVEN number How many subjects are there?
Otherwise PRINT ODD Number What is the formula to find the average marks?
Step 5 Stop
Q. What is planning to find average marks of a student?
Q. What are steps for drawing flowchart? Q. What are steps/ criteria to check efficiency of algorithm?
The flowchart developer must determine the following An algorithm must be analyzed very carefully. For maximum
requirements for the given problem or algorithm before efficiency of algorithm we must minimize resource usage. For this the
drawing a flowchart. algorithm developer must determine the following requirements for the
Input to the flowchart given problem.
Input: The algorithm developer must know what exactly the input. The
Type of processing required
input is determined from the problem statement. Input the correct data
Decisions to be taken
for algorithm.
The output to be produced after processing Processing: The algorithm developer must decide what type of calculation
Input: The flowchart developer must know what exactly the is to be performed or which formula is to be applied to obtain the
input to the flowchart is. The input is determined from the required result
problem statement. Decision: the developer must decide which control structure sequence,
Processing: The flowchart developer must decide what type of selection and repetition) are to be applied for the solution of the problem.
calculation is to be performed or which formula is to be applied to Decisions to be taken should be accurate.
obtain the required result
Output: The algorithm must provide the required output. The output to be
Decision: the developer must decide which control structure sequence,
produced after processing.
selection and repetition) are to be applied for the solution of the
Q. Define system and its components.
problem.
Output: The flowchart must provide the required output. A system is combinations of different components that work
Q. What is measuring efficiency of an algorithm? with each other perform specific tasks. Different procedures are
The efficiency of an algorithm is the property which relate the algorithm used to perform different tasks in the system.
to the amount of computational resources used in it. An algorithm must Q. Write planning to find the product of given numbers.
be analyzed to determine its resource usage (e.g. time, memory and PRODUCT = 1x3x5x7x9x11x13x15
storage space). For maximum efficiency we wish to minimize resource Planning the Solution:
usage.
Input: This problem has no input
PISK COMPUTER SCIENCE GRADE10 10
7. System Maintenance