1st PUC Computer Science Chapter 4 Notes – Introduction to Problem Solving
1st PUC / Class 11 – Simple Notes & Exam Preparation
Based on the NCERT textbook chapter. Every major topic and textbook example is covered in simple language.
AlgorithmsFlowchartsPseudocodeFlow of ControlVerificationCodingDecomposition📌 Chapter Overview
This chapter teaches how a computer problem is understood, solved step by step, represented as an algorithm, converted into a program, tested and improved.
📚 Table of Contents
- 4.1 Introduction
- 4.2 Steps for Problem Solving
- 4.3 Algorithm
- 4.3.1 Characteristics of a Good Algorithm
- 4.4 Representation of Algorithms
- 4.4.1 Flowchart – Visual Representation
- Example 4.1 – Square of a Number
- Example 4.2 – Non-functioning Light Bulb
- 4.4.2 Pseudocode
- Example 4.3 – Sum of Two Numbers
- Example 4.4 – Area and Perimeter of a Rectangle
- Benefits of Pseudocode
- 4.5 Flow of Control
- 4.5.1 Sequence
- 4.5.2 Selection
- Example 4.5 – Odd or Even
- Example 4.6 – Age Classification
- Example 4.7 – Dragons and Wizards
- 4.5.3 Repetition
- Example 4.8 – Average of 5 Numbers
- Example 4.9 – Average Until 0
- 4.6 Verifying Algorithms
- Time Addition – Verification Example
- 4.7 Comparison of Algorithm
- Time Complexity and Space Complexity
- 4.8 Coding
- Syntax
- Low-Level and High-Level Languages
- Source Code and Language Choice
- 4.9 Decomposition
- Chapter Summary
- Exam-Focused Important Questions
4.1 Introduction
Computers are used to do many tasks faster and more accurately. Railway reservation is one example of a complex task made easier with computers. Computers themselves cannot solve a problem; we must give precise step-by-step instructions. Problem solving means identifying a problem, developing an algorithm and implementing it as a computer program.
Key Points
- Computerisation means using computers and software to automate routine human tasks efficiently.
- Correct problem definition, correct algorithm and correct program are important.
- Problem solving is an essential skill in Computer Science.
4.2 Steps for Problem Solving
A complex problem needs a methodical approach. Problem solving starts with clearly identifying the problem and ends with a complete working program or software.
Key Points
- Analysing the problem – understand the problem and identify inputs and outputs.
- Developing an algorithm – prepare and refine the solution before coding.
- Coding – convert the final algorithm into a programming language.
- Testing and debugging – test different inputs, find errors and correct them.
- Maintenance – fix user problems and add or modify features after delivery.
4.3 Algorithm
An algorithm is a finite sequence of exact steps that solves a problem or accomplishes a required task. It has a definite beginning, a definite end and a finite number of steps.
Key Points
- It acts as a roadmap before writing a program.
- It improves reliability, accuracy and efficiency.
- More than one algorithm may solve the same problem.
- While writing an algorithm, clearly identify Input, Processing and Output.
- GCD example: GCD of 45 and 54 is 9.
4.3.1 Characteristics of a Good Algorithm
The chapter gives five important characteristics.
Key Points
- Precision – every step is clearly stated.
- Uniqueness – each step has a clearly defined result.
- Finiteness – the algorithm stops after a finite number of steps.
- Input – the algorithm receives input.
- Output – the algorithm produces output.
4.4 Representation of Algorithms
After identifying the logical steps, an algorithm can be represented using a flowchart or pseudocode. Both should show the solution logic and clearly reveal the flow of control.
Key Points
- Flowchart – graphical representation of an algorithm.
- Pseudocode – human-readable, non-formal representation of an algorithm.
4.4.1 Flowchart – Visual Representation
A flowchart uses standard shapes connected by arrows. Each shape represents a step and arrows show the order of flow.
Key Points
- Start/End (Terminator) – shows where the flow starts and ends.
- Process – represents an action or process.
- Decision – asks a yes/no or true/false question and branches.
- Input/Output – used to input or output data.
- Arrow – shows the order of flow.
Simple Flowchart Visual
Flowchart logic is redrawn as an educational SVG/CSS-style diagram; the small verakworld.com watermark is placed below each label.
Example 4.1 – Square of a Number
Input: number whose square is required. Process: multiply the number by itself. Output: square of the number.
Key Points
- Step 1: Input a number and store it in num.
- Step 2: Compute num * num and store it in square.
- Step 3: Print square.
Example 4.2 – Non-functioning Light Bulb
The chapter uses a flowchart to solve a simple real-life problem: checking a non-functioning bulb and deciding the next action based on conditions.
Key Points
- Follow the decision flow shown in the chapter.
- Use Decision symbols for condition checking.
- Use arrows to show the direction of the solution.
4.4.2 Pseudocode
Pseudocode is a non-formal language used to describe algorithm instructions in a particular order. It is intended for humans and cannot be executed directly by a computer. There is no single standard format.
Key Points
- INPUT
- COMPUTE
- INCREMENT
- DECREMENT
- IF/ELSE
- WHILE
- TRUE/FALSE
Example 4.3 – Sum of Two Numbers
The chapter represents the solution using simple pseudocode.
Key Points
- input num1
- input num2
- COMPUTE Result = num1 + num2
- PRINT Result
Pseudocode
input num1 input num2 COMPUTE Result = num1 + num2 PRINT Result
Example 4.4 – Area and Perimeter of a Rectangle
The chapter uses length and breadth as inputs and calculates both area and perimeter.
Key Points
- input length
- input breadth
- compute Area = length * breadth
- print Area
- compute Perim = 2 * (length + breadth)
- print Perim
Pseudocode
input length input breadth compute Area = length * breadth print Area compute Perim = 2 * (length + breadth) print Perim
Benefits of Pseudocode
Pseudocode gives a simple plan before actual coding.
Key Points
- Shows the basic functionality before coding.
- Helps avoid missing important steps.
- Easy for non-programmers to read and review.
- Helps confirm that the proposed solution can produce the desired output.
4.5 Flow of Control
Flow of control describes how events move through an algorithm. The chapter explains three forms: sequence, selection and repetition.
Key Points
- Sequence
- Selection
- Repetition / Iteration / Loop
4.5.1 Sequence
In sequence, all statements are executed one after another in order.
Key Points
- Examples 4.3 and 4.4 follow sequential execution.
- Each step is completed before the next step is performed.
4.5.2 Selection
Selection means choosing an alternative based on a condition. Conditions have true or false outcomes. In programming, ‘otherwise’ is represented using ELSE.
Key Points
- Example: if age >= 18, a person is eligible to vote; otherwise not eligible.
- Conditional statements perform actions depending on true/false values.
- Binary values mean True and False.
Example 4.5 – Odd or Even
Input: a number. Process: check whether it is divisible by 2. Output: Even or Odd.
Key Points
- PRINT “Enter the Number”
- INPUT number
- IF number MOD 2 == 0 THEN
- PRINT “Number is Even”
- ELSE
- PRINT “Number is Odd”
Pseudocode
PRINT "Enter the Number"
INPUT number
IF number MOD 2 == 0 THEN
PRINT "Number is Even"
ELSE
PRINT "Number is Odd"Example 4.6 – Age Classification
The chapter categorises a person as Child, Teenager or Adult.
Key Points
- INPUT Age
- IF Age < 13 THEN → Child
- ELSE IF Age < 20 THEN → Teenager
- ELSE → Adult
Pseudocode
INPUT Age
IF Age < 13 THEN
PRINT "Child"
ELSE IF Age < 20 THEN
PRINT "Teenager"
ELSE
PRINT "Adult"Example 4.7 – Dragons and Wizards
This card-game example demonstrates multiple conditions. Diamonds or clubs give a point to DRAGONS. A numbered heart gives a point to WIZARDS. A non-number heart gives a point to DRAGONS. Other cards give a point to WIZARDS. The team with the higher score wins.
Key Points
- Input: shape and value.
- Process: increase the appropriate team’s score.
- Output: winning team.
- Dpoint stores Dragon points and Wpoint stores Wizard points.
Pseudocode Structure
INPUT shape INPUT value SET Dpoint = 0, Wpoint = 0 IF diamond OR club → INCREMENT Dpoint ELSE IF heart AND number → INCREMENT Wpoint ELSE IF heart AND not a number → INCREMENT Dpoint ELSE → INCREMENT Wpoint IF Dpoint > Wpoint → Dragon team wins ELSE → Wizard team wins
4.5.3 Repetition
Repetition means doing something again and again. In programming it is also called iteration or loop.
Key Points
- A loop repeats statements until a specified condition is satisfied.
- For a fixed number of repetitions, a counter can keep track of repetitions.
- Example: accept 5 numbers and calculate their average.
- When the number of repetitions is unknown, WHILE can be used.
Example 4.8 – Average of 5 Numbers
The chapter uses count and sum to accept five numbers and calculate their average.
Key Points
- Set count = 0, sum = 0.
- While count < 5, input a number.
- Add the number to sum.
- Increase count by 1.
- Average = sum / 5.
- Print average.
Step 1: Set count = 0, sum = 0 Step 2: While count < 5 Step 3: Input num Step 4: sum = sum + num Step 5: count = count + 1 Step 6: average = sum / 5 Step 7: Print average
Example 4.9 – Average Until 0
Here the number of inputs is not known in advance. The user enters numbers until 0 is entered.
Key Points
- Set count = 0, sum = 0.
- Input num.
- While num is not equal to 0, add it to sum, increase count and input the next number.
- Average = sum / count.
- Print average.
Step 1: Set count = 0, sum = 0 Step 2: Input num Step 3: While num is not equal to 0 Step 4: sum = sum + num Step 5: count = count + 1 Step 6: Input num Step 7: average = sum / count Step 8: Print average
4.6 Verifying Algorithms
Verification checks whether an algorithm works correctly. A dry run means taking an input and following the algorithm step by step to see the result.
Key Points
- Verification helps identify incorrect steps.
- It can reveal missing details.
- It can show cases where an algorithm does not work as intended.
- Verifying before software development reduces the effort needed to find and fix mistakes.
Time Addition – Verification Example
The chapter shows why verification is important. Adding 4 hrs 50 mins and 2 hrs 20 mins directly gives 6 hrs 70 mins, which is not a valid time representation. The correct result is 7 hrs 10 mins.
Key Points
- Add hours and minutes separately.
- If mm_total >= 60, increase hh_total by 1.
- Then subtract 60 from mm_total.
- Print the corrected total time.
hh_total = hh1 + hh2
mm_total = mm1 + mm2
IF (mm_total >= 60) THEN
hh_total = hh_total + 1
mm_total = mm_total - 60
PRINT hh_total, mm_total4.7 Comparison of Algorithm
More than one algorithm can solve the same problem. The chapter compares four methods for checking whether a number is prime.
Key Points
- Method 1: test divisors from 2 up to the number.
- Method 2: test only up to half the number.
- Method 3: test only up to the square root of the number.
- Method 4: use a previously stored list of prime numbers.
- Different algorithms can be compared using processing time and memory.
Time Complexity and Space Complexity
Time complexity tells how much processing time an algorithm needs. Space complexity tells how much memory it needs.
Key Points
- Method 2 is better than Method 1 because it checks fewer values.
- Method 3 reduces calculations further by checking up to the square root.
- Method 4 can reduce calculations further but needs extra memory for the prime list.
- Algorithm choice depends on efficiency in time and memory.
| Concept | Simple Meaning |
|---|---|
| Time Complexity | How much processing time is needed? |
| Space Complexity | How much memory is needed? |
4.8 Coding
After finalising an algorithm, it is coded in a selected high-level programming language.
Key Points
- Coding converts the algorithm into instructions understood through a programming language.
- The programmer follows the syntax of the language.
- Coding procedures should be documented.
Syntax
Syntax is the set of rules or grammar governing the formulation of statements in a programming language.
Key Points
- It includes spelling.
- It includes the order of words.
- It includes punctuation.
Low-Level and High-Level Languages
Machine or low-level language uses binary digits 0 and 1 and is directly understood by computer hardware, but it is difficult for humans. High-level languages are closer to natural language and are easier to read, write and maintain.
Key Points
- High-level languages are more portable.
- Examples in the chapter: FORTRAN, C, C++, Java and Python.
- Low-level programs are tied more closely to a particular type of computer.
Source Code and Language Choice
A program written in a high-level language is called source code. It is translated into machine language using a compiler or interpreter.
Key Points
- Language choice depends on the platform and application.
- Applications may be desktop, mobile or web applications.
- Programs can also be written for embedded systems such as digital watches, traffic signals, vehicles and medical equipment.
Figure 4.2 – Flowchart to Calculate Square of a Number
Algorithm representation for finding the square of a number.
Figure 4.3 – Flowchart to Solve a Non-functioning Light Bulb
Decision-based flowchart from the textbook example.
Figure 4.4 – Flowchart to Display Sum of Two Numbers
Figure 4.5 – Flowchart to Calculate Area and Perimeter of a Rectangle
Figure 4.7 – Actions Depending on True or False of a Condition
Figure 4.8 – Flowchart to Check Whether a Number is Even or Odd
Figure 4.9 – Flowchart to Check Multiple Conditions
Figure 4.10 – Flowchart to Calculate the Average of 5 Numbers
Figure 4.11 – Flowchart to Accept Numbers Till the User Enters 0
4.9 Decomposition
Figure 4.2 – Flowchart to Calculate Square of a Number
Figure 4.3 – Flowchart to Solve a Non-functioning Light Bulb
Figure 4.4 – Flowchart to Display Sum of Two Numbers
Figure 4.5 – Flowchart to Calculate Area and Perimeter of a Rectangle
Figure 4.7 – Actions Depending on True or False of a Condition
Figure 4.8 – Flowchart to Check Whether a Number is Even or Odd
Figure 4.9 – Flowchart to Check Multiple Conditions
Figure 4.10 – Flowchart to Calculate the Average of 5 Numbers
Figure 4.11 – Flowchart to Accept Numbers Till the User Enters 0
Decomposition means breaking a complex problem into smaller and easier sub-problems. The smaller solutions are then combined logically to solve the larger problem.
Key Points
- Smaller problems are easier to solve.
- Each sub-problem can be examined in detail.
- Sub-problems can be solved independently.
- Different teams can work on different sub-problems.
- After solving them, they must be tested and integrated.
- Examples: mathematics and science problems, school event management, weather forecasting and delivery management.
Chapter Summary
The chapter focuses on solving problems systematically using algorithms and programs.
Key Points
- Algorithm = step-by-step solution.
- Good algorithm = precise, unique, finite, with input and output.
- Algorithms can be represented by flowcharts or pseudocode.
- Flow of control = sequence, selection and repetition.
- Algorithms should be verified before implementation.
- Algorithms can be compared using time and space complexity.
- Coding uses a programming language and its syntax.
- Decomposition divides a complex problem into smaller sub-problems.
Exam-Focused Important Questions
Prepare these questions from the chapter.
Key Points
- Define problem solving.
- Define algorithm.
- List the characteristics of a good algorithm.
- What are the two methods of representing an algorithm?
- Define flowchart and explain its symbols.
- Define pseudocode and list its common keywords.
- Explain sequence, selection and repetition.
- Write pseudocode to check odd/even.
- Explain the average-of-5-numbers algorithm.
- What is a dry run?
- Why should algorithms be verified?
- Differentiate time complexity and space complexity.
- Explain low-level and high-level languages.
- What is syntax?
- What is source code?
- Explain decomposition and its advantages.
📝 Short Questions & Answers
It is a finite sequence of exact steps used to solve a problem.
Precision, uniqueness, finiteness, input and output.
A graphical representation of an algorithm using standard symbols and arrows.
A human-readable, non-formal representation of an algorithm.
Choosing an action or alternative based on a condition.
Executing statements repeatedly until a specified condition is satisfied.
Following an algorithm with an input step by step to check its result.
The rules or grammar for forming statements in a programming language.
A program written in a high-level programming language.
Breaking a complex problem into smaller, easier sub-problems.
⚡ Quick Revision
- Problem solving → identify problem → algorithm → program.
- Algorithm → exact + finite steps.
- Good algorithm → Precision + Uniqueness + Finiteness + Input + Output.
- Representation → Flowchart + Pseudocode.
- Flow of control → Sequence + Selection + Repetition.
- Verification → Dry run and testing.
- Comparison → Time complexity + Space complexity.
- Coding → programming language + syntax.
- Decomposition → divide a complex problem into smaller problems.
🎯 Exam Point of View
- Learn all definitions exactly in simple meaning.
- Practise flowchart symbols.
- Practise pseudocode examples from the chapter.
- Understand IF/ELSE and WHILE.
- Remember the time-addition verification example.
- Know the difference between time and space complexity.
- Prepare the decomposition definition and advantages.
📖 Textbook Exercise Topics
The chapter exercises include pseudocode for division, a five-flip cake problem, multiples of 5, fixed loops, collecting ₹200, billing, GST, marks/percentage, greatest of numbers, colour classification, largest/smallest values, water bill, conditionals, flowchart symbols, improving an algorithm, factorial, Armstrong number and algorithm verification. These are kept as practice areas rather than adding unrelated material.
📝 This article was researched and written by Venkatesh A, Founder of verakworld.com.