CHAPTER NO- 1 "Problem Solving" for 10th Class
CHAPTER NO- 1 “Problem Solving”
What is meant by problem solving? What steps are involved in problem solving? Describe briefly.
Problem solving: – whenever we are writing a computer program, our purpose is to solve a problem computationally. So the basic purpose of compute programming is solution of our daily life problems of different areas. This process of programming is called problem solving. Problem solving is not just type a program and then checking its output but it is a process in which multiple steps are involved.
These steps are following:-
1. Define the problem:– First of all, problem is defined. What is purpose of program? What are inputs and outputs?
2. Solve the problem: – In second step, problem is solved theoretical on paper. Then program is written in general English that is called Algorithm.
3. Drawing flowchart: – The flowchart is practical form of Algorithm, which is made with geometrical symbols.
4. Program coding: – In this step program is written on computer in appropriate computer language. After writing the program. It is saved in computer.
5. Testing and debugging: – As program coding is completed then it is run, tested and corrected. This process called testing and debugging.
6. Documentation: – In this process, comments and notes about working of program are written. They will help in future to editing the program.
Define algorithm. Write down an algorithm to find the largest three number a, b, c.?
Algorithm:- The step by step procedure for solving a special problem is called algorithm. An algorithm to find out greater number:-
1. Read any three numbers A, B, C.
2. If A is greater then B and A is greater then C, then print greater number A as a
3. If B is greater then A and B is greater then C, then print greater number B as a
4. If C is greater then A and C is greater then B, then print greater number C as a
What for we use flowcharts? Write down the standard flowchart symbols.
FLOWCHART:- A geometrical representation of the solution of a problem or algorithm of a program is called flowchart.It helps the programmers to understand the program algorithm.It is very easy to translate a flow chart into program.With a flow chart the document process can be done easily.Symbols of flow chart:- These are different geometrical symbols that are used in drawing flowcharts. There are many symbols used in flow chart but most easy and commonly used are:
1. Terminal symbol: – The terminal symbol is used to show the starting and finishing of a process.Start/Stop.
2. Input output symbol: – The input output symbol use to input the data as well as the output of the result. Read As, B
3. Processing symbol: – This symbol is used to show the processing. Sum = A+B =4.
Decision symbol: – This symbol is used to make decision. Yes/No True/False
5. Arrows keys: – These are used to show the order is to be carried out arrows connect with complete diagram.
6. ON-Page connector: – If a flowchart is divided into many parts on the same page, the On-page connector symbol is used to connect one part of the flowchart with another one.
7. OFF-Page connector:- Some time when an algorithm is large and complicated, the flowchart is drawn on more than one page. In order to connect one part of the flowchart on one page with another part on another page, an off-page connector symbol is used.
What is programming debugging? Write the types of errors which can occur in programs.
The process of removing errors in computer programs is called debugging. There are three types of errors in a computer program.
(1) Syntax or Grammatical Error. (2) Logical Error. (3) Execution Error.
(A) Syntax Error: – By syntax errors, we mean those errors which are generated as a result of ignoring the grimmer or syntax of the programming language. For example, in BASIC, if you type PRINT instead of PRINT or type ENPUT instead of INPUT or type a statement like INPUT D, P1 without a statement number, clearly you are making errors. Such errors are called syntax errors.
(B) Logical Error: – Whenever there are no syntax errors in the program at the execution time, but still the program generates a non-valid result then it means that there is some logical error. It is important to note that logical errors, as the computer cannot detect them, are considered difficult to remove. For example, when we want to obtained the AVERAGE of THREE numbers, then we divided the SUM in THREE numbers. If we divided SUM in FOUR numbers instead of THREE that is a Logical Errors.
(C) Execution Error: – When the computer displays error massage at run time or execution time, even though the program neither contains syntax nor logical error, then such type of errors is called execution errors.Example: – Get three numbers, add Its and 2nd values and divided their sum by the 3rd value. The result is then display on the serene.