0% found this document useful (0 votes)
97 views

Computer (Unit2 Notes)

Algorithm designing

Uploaded by

Asifa Akhter
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views

Computer (Unit2 Notes)

Algorithm designing

Uploaded by

Asifa Akhter
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

PAKAN INTENATIONAL SCHOOL AL-HARAMAIN CAMPUS, ISLAMABAD

Grade: Nine Subject: Computer


Unit # 2: Computational Thinking and Algorithm
Note: Write short answers of the following questions.
Q.No.1: What is the major difference in solving simple problems and complex problems?
Ans: Simple problems involve applying straightforward methods or algorithms with few variables, whereas
complex problems require deeper analysis, often involving multiple variables, dependencies, and uncertainty.
Complex problems may lack clear solutions and require creativity and iterative approaches.
Q.No.2: Why software designers prefer to use IPO charts?
Ans: Software designers prefer IPO (Input-Process-Output) charts because they provide a structured way to
visualize and understand how inputs are processed to produce outputs in software systems. This helps in
designing clear and efficient algorithms and ensures that all inputs, processes, and outputs are considered during
software development.
Q.No.3: Differentiate between Computational thinking and Logical thinking.
Ans: Computational thinking involves problem-solving techniques that draw on concepts from computer
science, such as algorithms, abstraction, and decomposition, to tackle complex problems efficiently. Logical
thinking, on the other hand, focuses on reasoning and making deductions based on principles of logic, without
necessarily involving computational processes.
Q.No.4: Write four properties of Computational thinking.
Ans: Four properties of Computational thinking:
i. Decomposition: Breaking down a problem into smaller manageable parts.
ii. Pattern recognition: Identifying similarities or patterns within data or problems.
iii. Abstraction: Focusing on essential details while ignoring irrelevant information.
iv. Algorithm design: Developing step-by-step instructions or procedures to solve a problem or perform a
task.
Q.No.5: What are the methods used to design a solution?
Ans: Methods used to design a solution are:
• Problem analysis: Understanding the problem's requirements and constraints.
• Algorithm design: Creating a step-by-step procedure to solve the problem.
• Testing and debugging: Checking and correcting the solution to ensure it works correctly.
• Optimization: Improving the solution's efficiency or performance.
Q.No.6: Which Computational thinking technique breaks down the problem into smaller parts?
Ans: Decomposition breaks down complex problems into smaller, more manageable parts, making it easier to
understand and solve each component separately before integrating them into a complete solution.
Q.No.7: Identify 3 computing problems from other subjects that you are studying in your class.
Ans: Identify 3 computing problems from other subjects:
• Mathematics: Implementing algorithms for solving mathematical equations or graph theory problems.
• Biology: Simulating biological processes or analyzing genetic sequences.
• Geography: Developing geographic information systems (GIS) for mapping and spatial analysis.
Q.No.8: Why do we need to think computationally?
Ans: Computational thinking enables us to tackle complex problems systematically, develop efficient algorithms,
and automate processes. It fosters critical thinking, problem-solving skills, and prepares individuals to thrive in a
technology-driven world.
Q.No.9: The telephone numbers usually have 9 digits. Out of these 9, the first two digits represents the
area code and are it remained constant within a given area. The last 7 digits represent the number, and
it cannot begin with 0. How many different telephone numbers are possible with a given area code.
Ans: Assuming the first digit of the last 7 digits can't be 0, there are 9×1079 \times 10^79×107 possible
telephone numbers for a given area code (since the first two digits are fixed).
Q.No.10: From city A to city B, there are 4 different roads and from city B to city C there are 2 different
roads. Draw a map of given situation and identify how many possible routes are there that someone
can follow to reach from city A to city C passing by city B?
Ans: Given 4 roads from A to B and 2 roads from B to C, there are 4×2=8 are possible routes from city A to
city C passing through city B.
Q.No.11: Define the term problem.

Ans: A problem is a challenge or situation that needs to be our come using some action. The problems
are present in all field such as economic, healthcare, education, transportation, internet, biology and
many more.

Q.No.12: What is the role of identifying computing problems in problem solving?

Ans: Role of identifying computing problem in problem solving is:


a) Helps to clarify the problem's scope and requirements
b) Guides the development of effective solutions
c) Enhances the chances of finding a successful solution
d) Saves time and effort by addressing the real problem, not its symptoms.

Q.No.13: Write down the step we should follow while solving simple problem.

Ans: Steps should follow while solving a simple problem.


a) Define and analyse a problem: What is the problem and why it is happening?
b) Design a plan: What we are going to do (Algorithm)
c) Implement the plan: Code it by using some programming language.
d) Evaluate: did our plan work?

Q.No.14: What is I-P-O Model?

Ans: IPO (Input-Process-Output) plays a significant role in problem-solving by:


a) Helping to define the problem (Input)
b) Identifying and analysing possible solutions (Process)
c) Implementing and evaluating the chosen solution (Output)

Input Processing Output

Q.No.15: What is Computational thinking?

Ans: Computational thinking is a problem-solving approach that involves:

a) Breaking down complex problems into smaller parts


b) Analyzing and understanding relationships between components
c) Developing algorithms and models to solve problems
d) Evaluating and refining solutions.

Q.No.16: Why computational thinking is important while solving a problem?

Ans: Computational thinking is important when solving problems because it helps you:

a) Break down complex issues into manageable parts


b) Identify patterns and connections
c) Develop step-by-step solutions
d) Analyze data and make informed decisions
e) Create efficient and effective solutions

Q.No.17: What is logical thinking?

Ans: Logical thinking: The systematic evaluation of information and ideas to form a judgment or

decision, based on objectivity, clarity, consistency, and evidence.

Q.No.18: What is the role of logical thinking in problem solving?

Ans: The role of logical thinking in problem solving it to analyse situations, identify patterns, evaluate
options, and make sound decisions to reach effective solutions.

Q.No.19: What is Algorithm Thinking?


Ans: Algorithm thinking is a step-by-step approach to solve problems, involving:
a) Breaking down complex tasks into smaller steps
b) Identifying inputs, processes, and outputs
c) Developing a logical sequence of actions
d) Anticipating potential errors and corrections

Q.No.20: What is the role of Algorithm Thinking in problem solving?

The role of Algorithm Thinking in problem solving is to provide a clear, step-by-step approach to solve
complex problems efficiently, ensuring consistency, accuracy, and scalability.

Note: Long answers to the following extended response questions (ERQs)


Q.No.1: Identify whether the given problems are Decision Problem, Counting Problem or Search
Problem. Write your answer in front of each problem given below:
a. Does a given binary string have an even number of zeros?

• Type: Decision Problem


• Explanation: This problem asks whether a binary string meets a specific condition—whether the
number of zeros in the string is even or not. It is a decision problem because the answer is simply "yes"
or "no."

b. Flipping a coin result in Head or tails. I flip a coin 20 times, how many different sequences of heads
and tails are possible?

• Type: Counting Problem


• Explanation: This problem requires counting the number of possible sequences that can be formed
when flipping a coin 20 times. It involves calculating the total number of sequences (combinations)
rather than finding a specific sequence.

c. Does a certain Java program say "yes" to an empty input?

• Type: Decision Problem


• Explanation: This problem is asking whether a given Java program will produce a specific output
("yes") for a particular input (empty input). It is a decision problem because the result is a simple yes/no
answer based on the program's behavior.

d. How many ways can the letters of the word TRIANGLE be arranged?

• Type: Counting Problem


• Explanation: This problem involves calculating the number of distinct permutations of the letters in the
word "TRIANGLE." It is a counting problem as it requires finding the number of possible
arrangements.

e. N-queens problem: where the goal is to place eight queens on a chessboard such that no queen
attacks any other.
• Type: Search Problem
• Explanation: The N-queens problem involves finding a solution to place queens on a chessboard such
that no two queens can attack each other. It is a search problem because it requires finding one or more
solutions that satisfy the given constraints.

Q.No.2. A student has to take one course of physics, one of science and one of mathematics. He may
choose one of 3 physics courses (P1, P2, P3), one of 2 science courses (S1, S2) and one of 2 mathematics
courses (M1, M2). In how many ways can this student select the 3 courses he has to take?

To determine how many ways a student can select one course each from physics, science, and mathematics:

• Physics Courses: 3 options (P1, P2, P3)


• Science Courses: 2 options (S1, S2)
• Mathematics Courses: 2 options (M1, M2)

To find the total number of combinations, you multiply the number of choices for each category:

Total ways= Number of Physics Courses × Number of Science Courses × Number of Mathematics Courses
text
Total ways=3×2×2=12
Q.No.3. Create an IPO chart which will accept the ages of four boys and calculate their total age and
average age. The program must display both the total age and the average age.

IPO Chart:

Input Processing Output


Ages of four boys 1. Input the ages of four boys (A1, A2, A3, A4) Total age and average age
2. Calculate the total age: A1 + A2 + A3 + A4 Total age: T = A1 + A2 + A3 + A4
3. Calculate the average age: T / 4 Average age: A = T / 4
Output Total age: T, Average age: A
Q.No.4. Create an IPO chart of a scenario that allows a user to enter in two numbers. The operation to
be performed is either addition, subtraction, multiplication or division and accordingly the output
should be given to the user.

IPO Chart:

Input Processing Output


Two numbers (num1, num2) Input two numbers. Result of operation
Operation (add, subtract, Perform the operation based on the
Depending on the operation chosen
multiply, divide) input:
Addition: num1 + num2 Addition result: num1 + num2
Subtraction: num1 - num2 Subtraction result: num1 - num2
Multiplication: num1 * num2 Multiplication result: num1 * num2
Input Processing Output
Division: num1 / num2 (handle division Division result: num1 / num2 (if
by zero) num2 ≠ 0)
Q.No.5. The child wants to plan a birthday party for their friend.
a) Draw an IPO chart of this situation.

a) IPO Chart:

Input Processing Output


Details for party (guest list, date, time, Confirmation of
Input details for the party.
location, etc.) details
Confirmation of
Check the availability of venue.
venue
Send invitations to guests. Invitations sent status
Prepare party supplies (decorations, food,
Supplies list
etc.).
Finalize the schedule and plan for the
Final party plan
party.
Output Complete party plan

b) Write down properties on computation thinking.


b) Properties of Computational Thinking:

1. Decomposition: Breaking down a complex problem (planning a party) into smaller, manageable tasks
(guest list, venue, invitations, etc.).
2. Pattern Recognition: Identifying common elements in the party planning process (e.g., needing to send
invitations, arrange supplies).
3. Abstraction: Focusing on the essential details needed for planning (e.g., main tasks rather than every
detail).
4. Algorithm Design: Creating step-by-step procedures for each part of the planning process to ensure
everything is covered efficiently.
5. Evaluation: Assessing the effectiveness of the planning process and making adjustments as needed (e.g.,
ensuring invitations were received).

Q.No.6: Enlist the steps we should follow while designing a flowchart.


Start of the flowchart: The initial point in the flowchart where the process begins. This is often depicted as an
oval shape and signifies the entry point of the flowchart, indicating the commencement of a series of operations.
Input to the flowchart: Refers to the data or information that is required for the process to proceed. This is a
crucial component, as it provides the necessary input for the operations that follow. In the flowchart, it is
typically represented by a parallelogram.
Type of processing required: This describes the specific actions, tasks, or operations that are carried out on
the input data. It outlines the nature of the work done in this step, such as calculations, data manipulation, or
other procedures. It is represented by a rectangle in the flowchart.
Decision to be taken: A point in the flowchart where a choice must be made based on a condition or set of
conditions. This is a critical step that can lead to different paths or outcomes, depending on the decision made.
It is symbolized by a diamond shape and typically includes yes/no or true/false branches.
Output of the operation: The result produced after the input data has been processed. This could include final
products, reports, or data outputs. It represents the end result of the processing phase and is usually shown as a
parallelogram in the flowchart.
End of the flowchart: The concluding point of the flowchart, indicating that the process has reached its final
step. This is represented by an oval, similar to the start symbol, and denotes the completion of the flow or the
achievement of the process's goal.

You might also like