Problem Solving Using Computer

Problem solving is the process of finding solutions to problems encountered in life. A computer is a tool to solve a problem. Using a computer as a problem solving tool following steps are involved.

Problem Analysis

A clearly defined problem is already half the solution. Analyzing the problem require us to identify the following:
  • Input(s) to the problem
  • Output(s) expected from the problem
  • Special constraints or condition (if any)
  • Any Formulas or equations to be used
For example, Compute the Area of a Circle:
Inputs: radius of a circle
Outputs: Area of a circle
Formula: Area = 3.1415*radius*radius
i.e. A = PI*r^2

Algorithm Development & Flowcharting


Algorithm
An algorithm is an step-by-step procedure for solving a problem in a finite number of steps. An algorithm must possess following characteristics:
  1. Finiteness: An algorithm should have finite number of steps and it should end after a finite time.
  2. Input: An algorithm may have many inputs or no inputs at all.
  3. Output: It should result at least one output.
  4. Definiteness: Each step must be clear, well-defined and precise. There should be no any ambiguity.
  5. Effectiveness: Each step must be simple and should take a finite amount of time.

Following guidelines must be followed while develping an algorithm.

  1. An algorithm will be enclosed by START (or BEGIN) and STOP (or END).
  2. To accept data from user, generally used statements are INPUT, READ, GET or OBTAIN.
  3. To display result or any message, generally used statements are PRINT, DISPLAY, or WRITE.
  4. Generally, COMPUTE or CALCULATE is used while describing mathematical expressions and based on situation relevant operators can be used.
Flowchart
Flowchart is basically a pictorial or diagrammatic representation of an algorithm using standard symbols.
To express different operations in the flowchart various standard symbols are used. All symbols are connected among themselves in order to show the flow of information and processing. Different symbols as prescribed by American National Standard Institute (ANSI) which are frequently required while drawing flowchart are tabulated below:


Example of Algorithm and Flowchart


Coding

Coding is the real job of programmer. The algorithm and flowchart developed is converted into programming language like C, C++, .NET, JAVA, Python which is actually the source code.

Compilation & Execution

The source code written in any programming language is not directly executed by the computer. It should be translated into to the machine readable format i.e. actual machine language. The process of translation of source code into the target code is called the compilation. Each programming language has its own compiler program that translates the source code into its target code. The converted program in actual machine language is then executed by the computer which is known as program execution.

Debugging & Testing

A written program may have errors, some errors can be detected by the language compilers and some errors can not be identified by the compiler and occured during the program run. Common types of errors are

  • Syntax Errors:Identified by compiler at the program compilation time.
  • Logical Errors: Not identified by the compiler at compile time and identified at the execution time. e.g. misuse of operators
So testing is the process of checking the program for its correct functionality by executing the program with some input data set and observing the output of the program.

Program Documentation

From the start of the problem solving to the end of the implementation of the program, all the tasks should be documented i.e. kept for future reference. It is also the important part of the problem solving or program development. Documentation may be of two types

  • Technical Documentation known as programmer's documentations which includes the problem analysis to implementation details for that program. It is needed for future reference for any modification, update of the program.
  • User manual is the documentation prepared for the end-user of the program that guides the user how to operate the program.

Assignment Set

  1. What is the approach of solving a problem using computer?
  2. Explain the need of analysis and design phase in solving the problem.
  3. How does an algorithm differ from pseudo code? Develop an algorithm and pseudo code for a program to check whether the inputted number is prime or not.
  4. What is mean by Compilation? What is mean by Interpretation? How do these two processes differ?
Board Exam Questions
  1. Why do we need analysis and design before coding a program? [4] [2072]
  2. Explain the steps that are required to build a computer program for solving a certain problem. [6] [2074]
  3. List and define different steps to solve the problem in computer system. [4] [2071]
  4. Explain the steps of solving a problem using computer. [4+4] [2069]
  5. What are the steps required to develop a computer program? Explain. [5] [2070]
  6. Briefly explain the steps followed for developing computer software. [2] [2067]
  7. What is an algorithm and how it differs from pseudo-code? Develop algorithm and draw flowchart to find the largest of N numbers. [2+3+3] [2073]
  8. Does Algorithm and Flowchart design makes programming faster and easier? Describe with strong supporting points. Also draw flowchart to check whether a number is Armstrong or not. [2+3] [2068]
  9. Draw a flowchart and algorithm to find roots of a quadratic equation. [10]
  10. Define algorithm. Write an algorithm for finding largest and smallest values from a list. [2+6] [2068]
  11. What is a pseudo code? How is it different from an algorithm? Draw the flowchart to solve the multiplication of two matrices. [1+2+5] [2068]
  12. Flowchart is representation of an algorithm. Justify the statement with suitable example. [2]
  13. Define the term “Flowchart”. Discuss about different symbols used in Flowchart. [4] [2070]
  14. What are the advantages of a Flowchart design? Write down the guidelines to be followed to draw a flowchart. [2+2] [2073]
  15. What is a flow chart? Use the various commonly used flow chart symbols. How does a flow chart help computer programming? [2+2+2] [2072]
  16. Discuss the types of errors in programming. How do you debug a C-program? [2+4] [2073]
  17. What is mean by compilation? What is mean by interpretation? How do these two processes differ? [4] [2071]
  18. What is the purpose of the semicolon that appears at the end of most assignment statement in C? Explain the program compilation, linking and loading process with example. [2+4] [2073]
Problem Solving Using Computer
  • Introduction to Problem
  • Concept to Problem Solving
  • Problem Solving Approach
    • Problem Analysis
    • Algorithm Development
    • Flowcharting
    • Coding
    • Compiling and Execution
    • Debugging and Testing
    • Documentation
  • Basic Guideline to prepare algorithm
  • Tools used in Flow Chart Development
  • Tools used in Program Design for Problem Solving
    • Algorithm
    • Flowchart
    • Pseudo code
  • Errors and Error Category