Computer Science — Class 10

Unit 1: Problem Solving (Long Questions & Complete Exercises)

Q.1. Fill in the blanks.

  1. The set of instructions given to the computer to solve a problem is called program.
  2. The set of rules for writing programs in programming language is known as Syntax of the language.
  3. Flow chart is a Pictorial representation of algorithm.
  4. An algorithm solves a problem in Finite number of steps.
  5. During Analysis, a problem is decomposed into multiple sub-problems.
  6. Debugging is the process of finding and removing Errors in a program.
  7. Program Implementation refers to the installation of the program in the user environment.
  8. Occurrence of a Runtime error crashes the program.

Q.3. Write T for True and F for False statements.

  • i. Syntax errors occur due to wrong problem logic. — ( F )
  • ii. Top-down design is allowed to solve complex problems. — ( T )
  • iii. Desk checking is the process of verifying the working of an algorithm. — ( T )
  • iv. Debugging is an important part of analysis. — ( F )
  • v. Every stage of program development is documented. — ( T )
  • vi. A rectangle symbol is used for decision making in a flow chart. — ( F )
  • vii. Requirement document is not helpful at development stage. — ( F )
  • viii. The usual direction of flowchart is from right to left. — ( F )
  • ix. Annotation symbol is used for writing comments. — ( T )

Long Questions & Conceptual Solutions

Q.4. What do you mean by problem solving? Briefly describe the problem solving process.

Answer: Problem solving is the process of defining a problem, determining its cause, identifying and prioritizing solutions, and executing the best solution on a computer.

The core steps in the problem-solving process include:

  • Problem Identification: Clearly understanding what problem needs to be solved.
  • Specify Requirements: Writing down user requirements, inputs, and expected outputs.
  • Analyze the Problem: Breaking the problem into smaller manageable parts (Top-Down Design).
  • Design Algorithm & Flowchart: Planning a step-by-step procedure and visual diagram.
  • Write the Program (Coding): Translating the algorithm into a programming language.
  • Test & Debug: Finding and correcting syntax, runtime, and logical errors.
  • Implementation: Installing and running the program in the user environment.
  • Documentation: Writing detailed technical manuals and guidelines for future reference.

Q.5. What is debugging? How many types of errors can occur in a program? Describe briefly.

Answer: Debugging is the process of detecting, locating, and correcting errors (bugs) in a computer program.

Three main types of errors can occur:

  1. Syntax Errors: Occur when the rules or grammar of the programming language are violated. Detected during compilation.
  2. Runtime Errors: Occur during program execution when the computer is asked to perform an illegal operation (e.g., division by zero). Causes the program to crash.
  3. Logical Errors: Occur when there is a flaw in the program logic. The program runs without crashing, but yields incorrect results.

Q.6. Define algorithm. Write a step-form algorithm for making a telephone call to your friend.

Answer: An algorithm is a finite sequence of clear, step-by-step instructions designed to solve a specific problem.

Step 1: Start. Step 2: Pick up the telephone handset / unlock mobile phone. Step 3: Dial your friend's telephone number. Step 4: Wait for the call to ring and connect. Step 5: If the line is busy or unanswered, hang up and go to Step 8. Step 6: If answered, talk to your friend. Step 7: Disconnect / hang up the call when finished. Step 8: End.

Q.7. What are the advantages of flowchart? Discuss limitation of flowchart.

Advantages of Flowchart:

  • Provides a visual and easy-to-understand representation of program logic.
  • Helps effectively in analyzing and debugging programs.
  • Serves as standard documentation for software development and maintenance.

Limitations of Flowchart:

  • Drawing flowcharts for large and complex programs is difficult and time-consuming.
  • Any changes in program logic require redrawing the flowchart entirely.
  • Overuse of connectors can make the logic messy and hard to follow.

Q.8. Draw a flowchart to find the largest of three numbers.

Flowchart Logic Steps:

[Start] -> [Input A, B, C] -> B?> ├── YES: C?> │ ├── YES: Print "A is Largest" -> [End] │ └── NO: Print "C is Largest" -> [End] └── NO: C?> ├── YES: Print "B is Largest" -> [End] └── NO: Print "C is Largest" -> [End]

Q.9. Write an algorithm to calculate the area of circle when the radius is given. (Area = 3.14 * radius * radius)

Step 1: Start Step 2: Input radius Step 3: Calculate area = 3.14 * radius * radius Step 4: Display area Step 5: End

Q.10. Short Questions Answers

i. List steps that should be followed to solve a problem.
Problem Identification, Specify Requirements, Problem Analysis, Design Algorithm/Flowchart, Coding, Testing & Debugging, Implementation, and Documentation.

ii. What is analysis? Describe its importance in solving a problem.
Analysis is the phase where a complex problem is decomposed into smaller parts. It is vital because it ensures a clear understanding of inputs, outputs, and processing requirements before coding.

iii. What method should be adopted to solve complex problems? Discuss briefly.
The Top-Down Design (Divide and Conquer) method should be adopted. It breaks down a complex problem into smaller, manageable sub-modules.

iv. What do you mean by syntax of a programming language? Is it necessary to know the syntax for solving a problem on computer?
Syntax refers to the formal rules and grammar of a programming language. Yes, knowing syntax is necessary because compilers cannot translate statement errors into machine code.

v. Differentiate runtime errors and logical errors.
Runtime errors occur during execution due to illegal operations (e.g., division by zero) and crash the program. Logical errors result from incorrect logic, producing wrong answers without crashing.

vi. Why documentation is considered vital in problem solving process?
Documentation provides essential written guides for system maintenance, future upgrades, and assisting new developers in understanding the codebase.

vii. Is it necessary for an algorithm to solve a problem in finite number of steps? If yes, why?
Yes. An algorithm must terminate after a finite number of steps to avoid infinite loops and prevent wasting computer resources.

viii. Write purpose of the different flowchart symbols.

  • Oval: Start / End terminal.
  • Parallelogram: Input / Output operation.
  • Rectangle: Processing or calculation.
  • Diamond: Decision making condition.
  • Circle: Flowchart connector.

ix. Compare the flowchart and algorithm.
An algorithm is a text-based, step-by-step written plan, whereas a flowchart is a graphical/diagrammatic representation of that same logic.

x. Write an algorithm to calculate the distance covered by a car moving at an average speed v m/s in time t (s = vt).

Step 1: Start Step 2: Input average speed (v) and time (t) Step 3: Calculate distance s = v * t Step 4: Display distance (s) Step 5: End