Unit 7: Computational Thinking

Class 9 Computer Science · Punjab Board · Session 2026-27 · PECTAA syllabus

Computational thinking is a way of solving problems step by step, in the same clear way a computer follows instructions. It helps us break a big and difficult problem into small parts, find a pattern, remove extra details, and then write a clear plan to solve it. These skills are useful not only in computer science but also in everyday life, studies, and work.

What is Computational Thinking?

Computational thinking means thinking about a problem in a way that a computer can help solve it. It does not mean thinking like a computer. It means using clear and logical steps so that a problem becomes easy to understand and easy to solve. When we use computational thinking, we do not rush to the answer. First we understand the problem, then we plan, and then we act. This way of thinking is used by programmers, scientists, engineers, and students. It helps in writing programs, making decisions, and solving daily problems such as planning a route, organising work, or finding a mistake in a task.

The Four Parts of Computational Thinking

Computational thinking has four main parts: decomposition, pattern recognition, abstraction, and algorithm design. Decomposition means breaking a large problem into small parts. Pattern recognition means finding things that are similar or that repeat. Abstraction means keeping only the important details and ignoring the details that are not needed. Algorithm design means writing the steps in the correct order to solve the problem. These four parts work together. For example, to plan a school function, we break the work into parts, notice repeated tasks, ignore unimportant details, and then make a step-by-step plan.

Algorithms

An algorithm is a clear, step-by-step set of instructions to solve a problem or complete a task. A good algorithm has a clear start and a clear end, and every step is easy to understand. For example, a recipe is an algorithm because it tells us the steps in order to cook a dish. In computer science, an algorithm is written before a program is made, so the programmer knows exactly what the computer should do. An algorithm should be correct, clear, and complete. It should work for all valid inputs, and it should finish in a reasonable number of steps.

Example Algorithm: Finding the Largest of Three Numbers

Suppose we have three numbers, A, B, and C, and we want to find the largest one. First, we read the three numbers. Then we assume the first number, A, is the largest so far. Next, we compare B with the largest so far: if B is greater, then B becomes the largest. Then we compare C with the largest so far: if C is greater, then C becomes the largest. Finally, we display the largest number. This logic is correct because every number is compared with the current largest, so no number is missed. If two numbers are equal, the result is still correct because the equal value is already the largest.

Flowcharts

A flowchart is a diagram that shows the steps of an algorithm using symbols and arrows. It makes an algorithm easy to see and easy to understand. A flowchart starts with an oval for Start and ends with an oval for Stop. A parallelogram is used for input and output, a rectangle is used for a process or a calculation, and a diamond is used for a decision or a question with a Yes or No answer. Arrows show the flow, which is the order in which the steps are followed. For the largest of three numbers, the flowchart starts, reads A, B, and C, sets Largest to A, uses two diamond shapes to compare B and C, displays the largest number, and then stops.

Problem Solving with Computational Thinking

Computational thinking helps us solve real problems in a planned way. First, we understand the problem clearly. Then we break it into parts, look for patterns, and remove extra details. After that, we write an algorithm and test it with examples. If the result is wrong, we find the mistake and correct the steps. This method saves time and reduces errors. For example, if a student wants to improve marks, the problem can be broken into subjects, patterns in weak topics can be found, and a step-by-step study plan can be made and followed.

Key definitions

TermDefinition
Computational ThinkingA method of solving problems by breaking them into small parts, finding patterns, removing extra details, and writing clear step-by-step instructions.
DecompositionBreaking a large or complex problem into smaller and easier parts so that each part can be solved separately.
Pattern RecognitionFinding similarities, trends, or things that repeat in a problem, which helps in solving similar problems more quickly.
AbstractionFocusing only on the important information needed to solve a problem and ignoring unnecessary details.
AlgorithmA clear, ordered set of steps with a definite start and end, written to solve a problem or complete a task.
FlowchartA diagram that represents an algorithm using standard symbols such as ovals, rectangles, diamonds, and parallelograms, connected by arrows.
PseudocodeA simple way of writing an algorithm in plain, everyday language that looks like a program but is not written in a real programming language.

Important points

  • Computational thinking has four parts: decomposition, pattern recognition, abstraction, and algorithm design.
  • Decomposition breaks a big problem into small parts.
  • Pattern recognition finds similarities and repeating patterns.
  • Abstraction keeps important details and removes extra details.
  • An algorithm is a step-by-step plan with a clear start and end.
  • In a flowchart, an oval is used for Start and Stop.
  • In a flowchart, a rectangle is used for a process and a diamond is used for a decision.
  • In a flowchart, a parallelogram is used for input and output.
  • To find the largest of three numbers, compare each number with the current largest value.
  • A good algorithm is clear, correct, and complete, and it finishes in a finite number of steps.

MCQs — test yourself

1. What is computational thinking?

  1. Thinking like a computer machine
  2. A method of solving problems through clear, logical steps
  3. Only writing computer programs
  4. Memorising computer parts
Show answer

Answer: B — A method of solving problems through clear, logical steps. Computational thinking is a step-by-step, logical way to understand and solve problems.

2. Which of the following is NOT one of the four parts of computational thinking?

  1. Decomposition
  2. Pattern recognition
  3. Abstraction
  4. Memorisation
Show answer

Answer: D — Memorisation. The four parts are decomposition, pattern recognition, abstraction, and algorithm design.

3. Breaking a big problem into small parts is called:

  1. Abstraction
  2. Decomposition
  3. Pattern recognition
  4. Debugging
Show answer

Answer: B — Decomposition. Decomposition means dividing a large problem into smaller, manageable parts.

4. Focusing on important details and ignoring extra details is called:

  1. Decomposition
  2. Algorithm
  3. Abstraction
  4. Flowchart
Show answer

Answer: C — Abstraction. Abstraction keeps only the information needed to solve the problem.

5. An algorithm is:

  1. A computer hardware part
  2. A step-by-step set of instructions to solve a problem
  3. A type of flowchart symbol
  4. A computer virus
Show answer

Answer: B — A step-by-step set of instructions to solve a problem. An algorithm is a clear, ordered set of steps with a start and an end.

6. In a flowchart, which symbol is used for Start and Stop?

  1. Rectangle
  2. Diamond
  3. Oval
  4. Parallelogram
Show answer

Answer: C — Oval. An oval is used for the Start and Stop of a flowchart.

7. In a flowchart, a diamond is used for:

  1. Input
  2. Output
  3. A process
  4. A decision
Show answer

Answer: D — A decision. A diamond shows a decision, usually a question with a Yes or No answer.

8. In a flowchart, a parallelogram is used for:

  1. Input and output
  2. A decision
  3. Start and Stop
  4. A calculation
Show answer

Answer: A — Input and output. A parallelogram represents input, such as reading data, and output, such as displaying a result.

9. In the algorithm to find the largest of three numbers A, B, and C, what is the first step after reading the numbers?

  1. Display C
  2. Set Largest = A
  3. Compare B and C only
  4. Stop the algorithm
Show answer

Answer: B — Set Largest = A. We first assume A is the largest, then compare B and C with it one by one.

10. Pseudocode is:

  1. A real programming language
  2. An algorithm written in simple, plain language
  3. A flowchart symbol
  4. A type of computer hardware
Show answer

Answer: B — An algorithm written in simple, plain language. Pseudocode describes an algorithm in everyday language without strict programming rules.

Short questions

1. What is computational thinking?

Computational thinking is a way of solving problems through clear and logical steps. It includes breaking a problem into small parts, finding patterns, removing extra details, and writing a step-by-step plan. It helps in programming and in everyday problem solving.

2. Name the four parts of computational thinking and explain any one.

The four parts are decomposition, pattern recognition, abstraction, and algorithm design. Decomposition means breaking a large problem into small parts so that each part can be solved easily and separately.

3. What is an algorithm? Give one example.

An algorithm is a clear, ordered set of steps to solve a problem, with a definite start and end. For example, a cooking recipe is an algorithm because it gives the steps in order to prepare a dish.

4. Write the algorithm to find the largest of three numbers.

Step 1: Read three numbers A, B, and C. Step 2: Set Largest = A. Step 3: If B is greater than Largest, set Largest = B. Step 4: If C is greater than Largest, set Largest = C. Step 5: Display Largest and stop.

5. What is a flowchart? Name the symbols used for Start, decision, and input/output.

A flowchart is a diagram that shows the steps of an algorithm with symbols and arrows. An oval is used for Start and Stop, a diamond is used for a decision, and a parallelogram is used for input and output.

Summary

Computational thinking helps us solve problems in a clear and planned way. Its four parts are decomposition, pattern recognition, abstraction, and algorithm design. An algorithm is a step-by-step plan to solve a problem, and a flowchart shows that plan with symbols. The example of finding the largest of three numbers shows how comparing each number with the current largest value gives the correct answer.

← Back to Class 9 Computer Science chapter list