9th Class Computer Science Unit 7 Computational Thinking – Notes, MCQs and Questions (New Syllabus)

Last updated: 4 December 2026 · Punjab Board 9th Class Computer Science and Entrepreneurship (new syllabus 2025-26) · Unit 7

Easy, exam-focused notes for Unit 7: Computational Thinking of the new Punjab Board 9th class Computer Science book. Short answers are written to fit the board e-sheet answer space. All exercise MCQs are checked against the textbook answer key.

In this unit

  1. Computational thinking and its 4 components
  2. Principles of computational thinking
  3. Flowcharts and symbols
  4. Pseudocode with examples
  5. Time and space complexity
  6. Dry run and simulation
  7. LARP
  8. Errors and debugging
  9. Exercise: MCQs, short and long questions
  10. FAQs

7.1 Computational thinking (CT)

Computational thinking is a problem-solving approach that uses a set of skills to solve complex problems in a way a computer could carry out. It is useful in every field – science, maths and daily life (planning a trip, organising tasks).

ComponentMeaningExample
DecompositionBreaking a big problem into smaller, manageable partsBuilding a birdhouse: design → gather materials → cut wood → assemble → paint → install
Pattern recognitionFinding similarities or regularitiesArea of squares 1, 4, 9, 16 … = sums of odd numbers (1, 1+3, 1+3+5 …)
AbstractionHiding unnecessary details and keeping only the essential onesMaking tea: boil water → add tea → steep → pour (ignore brand of kettle, etc.)
AlgorithmA step-by-step set of instructions to solve a problemA cake recipe; steps to plant a tree

7.2 Principles of computational thinking

  • Problem understanding – the first and most important step: find the core issue, requirements and goals. It gives clarity, clear goals, efficient solutions and fewer mistakes. Example: before building a school website, list the pages needed, the users (students, teachers, parents) and the tools available.
  • Problem simplification – break it into sub-problems (website: layout, content, coding).
  • Solution selection and design – compare approaches, choose the most efficient one and make a detailed plan or algorithm.

7.3.1 Flowcharts

A flowchart is a diagram of the steps of a process using standard symbols joined by arrows. Benefits: clarity, communication, problem solving (finding bottlenecks) and documentation. Standard symbols were set by ANSI in 1947.

SymbolNameUse
OvalTerminalStart / End
RectangleProcessA task or calculation, e.g. Sum = A + B
ParallelogramInput / OutputRead input or display output
DiamondDecisionYes/No or True/False question
ArrowFlowlineDirection of flow

Example (shop order): Start → Get order → Item available? No → notify customer → End; Yes → pick, pack and ship → Customer pays? Yes → deliver, increase rating; No → bring item back, decrease rating → End.

7.3.2 Pseudocode

Pseudocode describes an algorithm in simple, structured English. It is not real code and cannot run, but it is easy to read and easy to turn into any programming language. Benefits: clarity, planning, communication.

Procedure CheckEvenOdd(number)
Begin
  if (number % 2 == 0) then
     print "Even"
  else
     print "Odd"
  end if
End
Procedure IsPrime(number)
Begin
  if (number <= 1) then return False
  for i from 2 to sqrt(number) do
     if (number % i == 0) then return False
  end for
  return True
End

We only check divisors up to √number, because any larger factor would pair with a smaller one already checked.

PseudocodeFlowchart
Plain, structured languageGraphical symbols and arrows
Read like a story, step by stepSeen like a picture of the whole flow
Easy to convert into codeEasy to see decisions at a glance
Better for detailed logicBetter for explaining to non-programmers

7.4 Algorithm evaluation

  • Time complexity: how the running time grows as the input grows (searching 10 vs 1,000 names). Written in Big O, e.g. O(n), O(log n), O(n²). Fewer steps = faster algorithm.
  • Space complexity: how much memory the algorithm needs as input grows.

7.5 Dry run and simulation

A dry run means going through an algorithm by hand, step by step, with sample data to check that it works and to catch logical errors early.

FindMax: Input num1, num2
if num1 > num2 then max = num1
else max = num2
Output max

Dry run (10, 15): 10 > 15? False → max = 15 → Output 15

Simulation uses a computer model of a real process to test ideas without real-life risk. Benefits: cheap, safe, repeatable. Examples: weather forecasting, city traffic planning.

7.6 LARP

LARP (Logic of Algorithms for Resolution of Problems) is software for learning algorithms by writing them as pseudocode or flowcharts and running them to see results. It helps students understand how algorithms work, see the effect of different inputs, and practise improving them. Its simple commands include START, END, WRITE (display), READ (input) and IF…THEN…ELSE…ENDIF.

START
  WRITE "Enter a number"
  READ number
  IF number % 2 == 0 THEN
     WRITE "The number is even"
  ELSE
     WRITE "The number is odd"
  ENDIF
END

7.7 Errors and debugging

ErrorMeaningExample
Syntax errorWrong writing/symbol in the algorithm; easiest to find (LARP points it out)Missing ENDIF or wrong symbol
Runtime errorHappens while runningDividing by zero
Logical errorRuns but gives wrong answers; hardest to findUsing > instead of < in a decision
  • Debugging techniques: trace the steps, use comments, check conditions, simplify the problem and test parts separately. (The word comes from a real moth found inside an early computer.)
  • Common LARP messages: Missing step, Undefined variable (used before being given a value), Invalid operation (e.g. divide by zero).

Unit 7 exercise (solved)

A. Multiple choice questions

1. Which of the following best defines computational thinking?
(a) A method of solving problems using mathematical calculations only   (b) A problem-solving approach that employs systematic, algorithmic, and logical thinking   (c) A technique used exclusively in computer programming   (d) An approach that ignores real-world applications
Answer: (b) A problem-solving approach that employs systematic, algorithmic, and logical thinking – CT is used in every field, not only programming.

2. Why is problem decomposition important in computational thinking?
(a) It simplifies problems by breaking them down into smaller, more manageable parts   (b) It complicates problems by adding more details   (c) It eliminates the need for solving the problem   (d) It is only useful for simple problems
Answer: (a) It simplifies problems by breaking them down into smaller, more manageable parts – Smaller parts are easier to solve.

3. Pattern recognition involves:
(a) Finding and using similarities within problems   (b) Ignoring repetitive elements   (c) Breaking problems into smaller pieces   (d) Writing detailed algorithms
Answer: (a) Finding and using similarities within problems – Breaking into pieces is decomposition.

4. Which term refers to the process of ignoring the details to focus on the main idea?
(a) Decomposition   (b) Pattern recognition   (c) Abstraction   (d) Algorithm design
Answer: (c) Abstraction – Abstraction keeps only essential details.

5. Which of the following is a principle of computational thinking?
(a) Ignoring problem understanding   (b) Problem simplification   (c) Avoiding solution design   (d) Implementing random solutions
Answer: (b) Problem simplification – Others are the opposite of CT.

6. Algorithms are:
(a) Lists of data   (b) Graphical representations   (c) Step-by-step instructions for solving a problem   (d) Repetitive patterns
Answer: (c) Step-by-step instructions for solving a problem – Graphical representation is a flowchart.

7. Which of the following is the first step in problem-solving according to computational thinking?
(a) Writing the solution   (b) Understanding the problem   (c) Designing a flowchart   (d) Selecting a solution
Answer: (b) Understanding the problem – You must understand a problem before solving it.

8. Flowcharts are used to:
(a) Code a program   (b) Represent algorithms graphically   (c) Solve mathematical equations   (d) Identify patterns
Answer: (b) Represent algorithms graphically – They are diagrams of algorithms.

9. Pseudocode is:
(a) A type of flowchart   (b) A high-level description of an algorithm using plain language   (c) A programming language   (d) A debugging tool
Answer: (b) A high-level description of an algorithm using plain language – It cannot be run like real code.

10. Dry running a flowchart involves:
(a) Writing the code in a programming language   (b) Testing the flowchart with sample data   (c) Converting the flowchart into pseudocode   (d) Ignoring the flowchart details
Answer: (b) Testing the flowchart with sample data – It is done by hand with sample values.

B. Short questions

Q1. Define computational thinking.
Computational thinking is a problem-solving process that uses decomposition, pattern recognition, abstraction and algorithms to solve complex problems in a way a computer could carry out.
Q2. What is decomposition in computational thinking?
Breaking a complex problem into smaller, manageable parts that can be solved one by one. Example: building a birdhouse is split into design, materials, cutting, assembling, painting and installing.
Q3. Explain pattern recognition with an example.
Finding similarities or regularities in data or problems. Example: areas of squares 1, 4, 9, 16 are sums of consecutive odd numbers (1, 1+3, 1+3+5, 1+3+5+7).
Q4. Describe abstraction and its importance in problem-solving.
Abstraction hides unnecessary details and keeps only the important ones, e.g. tea-making steps without worrying about the kettle’s brand. It reduces complexity so we can focus on the main idea.
Q5. What is an algorithm?
A precise, step-by-step set of instructions to solve a problem or complete a task, like a recipe for baking a cake.
Q6. How does problem understanding help in computational thinking?
It gives clarity about what must be solved, sets clear goals, leads to efficient solutions and prevents mistakes and wasted effort.
Q7. What are flowcharts and how are they used?
Flowcharts are diagrams that show the steps of an algorithm with standard symbols (oval, rectangle, parallelogram, diamond) joined by arrows. They are used to plan, explain and document processes and to find errors.
Q8. Explain the purpose of pseudocode.
Pseudocode describes an algorithm in simple, structured English so the logic can be planned and shared without worrying about programming-language syntax, and later turned into real code.
Q9. How do you differentiate between flowcharts and pseudocode?
Flowcharts use graphical symbols and show the flow visually; pseudocode uses structured text written step by step. Flowcharts are easier to see at a glance; pseudocode is closer to real code.
Q10. What is a dry run and why is it important?
A dry run is going through an algorithm by hand with sample data. It checks that the algorithm is correct and catches logical errors before coding, saving time.
Q11. Describe LARP and its significance in learning algorithms.
LARP (Logic of Algorithms for Resolution of Problems) is software where students write pseudocode or flowcharts and run them. It shows step-by-step results, helps understand logic and practise and improve algorithms.
Q12. List and explain two debugging techniques.
(1) Trace the steps – follow each step to see where it goes wrong. (2) Check conditions – make sure every decision uses the correct condition. (Also: use comments, simplify and test parts separately.)

C. Long questions

Q1. Algorithm to assign a grade (90+ A+, 80–89 A, 70–79 B, 60–69 C, below 60 F)
START
  WRITE "Enter marks"
  READ marks
  IF marks >= 90 THEN
     WRITE "Grade A+"
  ELSE IF marks >= 80 THEN
     WRITE "Grade A"
  ELSE IF marks >= 70 THEN
     WRITE "Grade B"
  ELSE IF marks >= 60 THEN
     WRITE "Grade C"
  ELSE
     WRITE "Grade F"
  ENDIF
END

Dry run: marks = 76 → not >= 90, not >= 80, >= 70 True → "Grade B"

Flowchart: Start (oval) → Input marks (parallelogram) → diamond “marks ≥ 90?” Yes → Output A+; No → diamond “≥ 80?” Yes → A; No → “≥ 70?” → B; No → “≥ 60?” → C; No → F → End.

Q1. How would you use flowcharts and pseudocode to solve a complex problem? Give an example.
  • Understand and decompose the problem (e.g. a shop order system: order, stock check, payment, delivery, rating).
  • Draw a flowchart to see the decisions (item available? customer pays?).
  • Write pseudocode for each part in detail.
  • Dry run with sample orders, fix errors, then code it.
Q2. Define computational thinking and its significance with examples from different fields.
  • Definition as above; four components.
  • Medicine: finding patterns in symptoms. Weather: simulations to forecast. Daily life: planning a trip or study timetable. Business: processing orders efficiently.
Q3. Decomposition – concept and importance.
Breaking a problem into parts makes it less overwhelming, lets different people work on different parts, makes testing easier and helps find errors. Example: birdhouse or school website.
Q4. Pattern recognition – how does it help?
It finds repeated features so a solution used once can be reused, predictions can be made and work is reduced. Example: square areas as sums of odd numbers; noticing you forget homework on Mondays and setting a Sunday reminder.
Q5. Abstraction – importance and examples.
It keeps only the essential details: a map shows roads but not every tree; making tea lists only the key steps; a car driver uses the steering and pedals without knowing the engine’s inner working.
Q6. What is an algorithm? Give a detailed example with flowchart.
See the grade algorithm and flowchart above (or FindMax: input two numbers → compare → output the larger).
Q7. Compare flowcharts and pseudocode with advantages and disadvantages.
  • Flowchart + visual, easy for beginners and non-programmers; – large ones get messy, hard to change.
  • Pseudocode + quick to write and edit, close to code; – less visual, no fixed standard.
  • Use a flowchart to explain a process to a team; use pseudocode before coding a program.
Q8. Concept of a dry run for flowcharts and pseudocode.
Walk through each symbol or line with sample values, writing the value of every variable. Example: sum of 3 and 5 → Sum = 8; FindMax(10, 15) → 15. If the output is wrong, there is a logical error to fix.
Q9. What is LARP? Discuss its importance.
LARP lets students write and execute algorithms and flowcharts, see step-by-step results and error messages, try different inputs and learn logic without complex programming syntax.
Q10. How does LARP enhance computational thinking? Give a scenario.
Students decompose a problem, write the algorithm in LARP, run it with many inputs and debug it. Scenario: a tax algorithm (“tax applies if annual salary ≥ 1,200,000”) is run with different salaries; if a wrong result appears, the condition is fixed and re-run until correct.
9th class computer unit 7 MCQs with answers

Unit 7 (Computational Thinking) exercise MCQ answers: 1-b, 2-a, 3-a, 4-c, 5-b, 6-c, 7-b, 8-b, 9-b, 10-b.

What are the 4 components of computational thinking?

Decomposition, pattern recognition, abstraction and algorithms.

What are flowchart symbols?

Oval (start/end), rectangle (process), parallelogram (input/output), diamond (decision) and arrow (flow line).

What is LARP in computer science 9th class?

LARP stands for Logic of Algorithms for Resolution of Problems; it is software to write and run pseudocode and flowcharts.

Types of errors in algorithms

Syntax errors, runtime errors (e.g. divide by zero) and logical errors (wrong results).

📄 Download these notes as PDF

Save this chapter to your phone or computer and read it offline, or share it with your friends.

The PDF downloads directly. Long chapters may take a few seconds.

More 9th Class Computer Science

Need a Computer Science home tutor?

Male & female Computer Science tutors in all major cities of Pakistan, home or online. 3-day free demo.

Scroll to Top