Unit 2 Computational Thinking Algorithms
MCQs
1. For a problem we face in real-world situations, in what sequence do we follow the steps?
I. make some solution.
II. understand the real-world problem.
III. instruct the computer to behave accordingly.
a) I, III, II
b) I, II, III
c) II, I, III
d) II, III, I
2. Following are types of computing problems:
I. Counting Problems
II. Search Problems
III. Decision Problem
a) I and II
b) I and III
c) II and III
d) I and II and III
3. Computational thinking is:
a) Programming
b) Thinking like a computer
c) Coding
d) Logically solving problems
4. To solve Search problems, we need to:
a) Provide the moves
b) Provide start state
c) Provide the end state
d) a, b, and c
5. The eight queens puzzle is the problem of:
a) Sorting
b) Searching
c) Counting
d) Both a and b
6. Finding the location of the element with a given value is:
a) Search
b) Traversal
c) Sort
d) None of above
7. In IPO Charts, we have:
a) Input, Plan, Output
b) Input, Program, Output
c) Input, Process, Output
d) Input, Proceed, Output
SRQs
Q1. What is the major difference in solving simple problems and complex problems?
24
The major difference lies in the process complexity. Simple problems follow a 4-step process:
define, plan, implement, and evaluate. Complex problems require a 6-step process: define and
analyze, decompose, identify potential plans for sub-problems, select and design the best plan,
implement, and evaluate. Complex problems demand deeper analysis, breaking down into
subproblems, considering multiple plans, and deeper evaluation as compared to simple
problems.
Q2. Why do software designers prefer to use IPO charts?
Software designers use IPO charts to visually organize program input, processing, and output
in table format. They aid in understanding problems and facilitate efficient problem-solving
and decision-making in software development.
Q3. Differentiate between Computational thinking and Logical thinking.
Computational thinking uses computer science concepts for problem-solving, while logical
thinking uses reasoning and logical principles for deductions. Computational thinking applies
systematic approaches to complex problems (abstraction, pattern recognition, algorithm
design) while logical thinking focuses on sound reasoning and deduction to arrive at
conclusions.
Q4. Write four properties of Computational thinking.
There are four properties of Computational thinking:
1. Decomposition: Breaking a complex problem into smaller, more manageable parts.
2. Abstraction: Focusing on the essential details of a problem while ignoring unnecessary
information.
3. Pattern Recognition: Identifying similarities or patterns within a problem that can help
find a solution.
4. Algorithm Design: Developing step-by-step procedures or algorithms to solve
Q5. What are the methods used to design a solution?
The methods used to design a solution include flowcharts and concept maps. A flowchart is a
diagrammatic representation of an algorithm, It describes what operations are required to solve
a given problem. A concept map is a graphical tool that represents concepts and relationships
between them. Both methods help in understanding problems and designing effective solutions.
Q6. Which Computational thinking technique breaks down the problem into smaller
parts?
Decomposition divides the problem into smaller, more manageable parts and working on them
one by one. These smaller problems are referred to as subproblems. This way we simplify the
problem and solve it easily.
Q7. Identify 3 computing problems from other subjects that you are studying in your
class.
Three simple problems from various subjects are:
Mathematics: Adding two numbers together or finding the perimeter of a square.
25
English: Identifying the main idea of a paragraph or writing a simple sentence.
Physics: Observing the behavior of magnets to understand the concept of magnetism
Q8. Why do we need to think computationally?
We need to think computationally because it helps us clearly reflect on a problem and develop
a repeatable solution for it. It aids in designing an automated system that can solve all instances
of a similar problem. Computational thinking is an extension of logical thinking.
Q9. The telephone numbers usually have 9 digits. Out of these 9, the first two digits
represent the area code and they remain 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?
The telephone numbers are of the format:
___ ___ - ___ ___ ___ ___ ___ ___ ___
The first two digits represent the area code, which is fixed and constant.
The third digit cannot be 0, so it can be any number from 1 to 9 (9 possible options).
The last 6 digits can be any number from 0 to 9 (10 possible options for each digit).
Total number of possible phone numbers=1×1×9×10×10×10×10×10×10=9×106
Q10. 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?
26
ERQs
Q1. Identify whether the given problems are Decision Problem, Counting Problem, or
Search Problem. Write your answer in front of each problem:
a) Does a given binary string have an even number of zeros? Decision Problem
b) Flipping a coin result in heads or tails. I flip a coin 20 times, how many different
sequences of heads and tails are possible? Counting Problem
c) Does a certain Java program say "yes" to an empty input? Decision Problem
d) How many ways can the letters of the word TRIANGLE be arranged? Counting
Problem
e) N-queens problem: where the goal is to place eight queens on a chessboard such that
no queen attacks any other. Search Problem
Problem Type Guiding Principle
Decision Problem Asks a yes/no question
Counting Problem Asks how many possibilities
Search Problem Asks how to find a solution
Q2. 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). How many ways can this student select the 3
courses he has to take?
The student can choose:
• 3 physics courses (P1, P2, P3)
• 2 science courses (S1, S2)
• 2 math courses (M1, M2)
Total ways to select = 3×2×2 = 12 ways
Q3. Create an IPO chart that 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.
Input Process Output
Ages of four boys A1, A2, A3, TOTAL = A1+A2+A3+A4 TOTAL and
A4 AVERAGE = AVERAGE
(A1+A2+A3+A4)/4 age
Q4. 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.
27
Input Processing Output
Two numbers, NUM1 ADD = NUM1 + NUM2 ADD
and NUM2 SUBTRACT = NUM1 - NUM2 SUBTRACT
MULTIPLY = NUM1 * NUM2 MULTIPLY
DIVIDE = NUM1 / NUM2 DIVIDE
Q5.The child wants to plan a birthday party for their friend.
a) Draw an IPO chart of this situation.
Input Processing Output
Child's ideas, Planning activities, games, Organized birthday party with
preferences, party decorations, and food for enjoyable activities, decorations,
resources the party and food for a friend
b) Write down properties on computation thinking.
• Decomposition: Selecting theme, decorations, food, activities, and budget for the
party.
• Abstraction: Consider available resources and budget.
• Pattern Recognition: Identifying patterns in successful birthday parties like:
o Popular games
o Favorite foods
o Preferred theme
o Time
• Algorithm Design: Write a step-by-step procedure for arranging the party involving:
o Time
o Venue
o Guests
o Games
o Food
o Decoration
o Budget
Activity 1: Draw a flowchart in MS Visio that takes input of two numbers A and B and
outputs TRUE if A is greater than B, otherwise it should output FALSE.
28
Activity 2 and 3: Draw IPO chart, flowchart and algorithm for the following:
a) Find the exponent of a given number: Exponent or power of a number means how many
times to use the number in multiplication. In other words, it is the product of a number that is
multiplied as many times as the exponent.
Input Process Output
A number and its Multiply the number as many times as its Exponent of given
exponent exponent number
b) Print odd numbers from 1 to 100. Such as 1, 3, 5, 7, 9, 11...99.
Input Process Output
The problem has Initialize a variable to 1 and keep printing it Printing odd numbers
no input with an increment of 2 until 99 from 1 to 100
29
c) Print the following sequence of numbers in descending order:
27, 24, 21, 18, 15, 12, 9, 6, 3, 0, -3, -6.
Input Process Output
This problem Initialize a variable to 27 and then keep Printing numbers from 27 to
has no input. printing it with a decrement of 3 till -6. -6 in descending order.
30
d) Find the sum of even numbers up to 100.
SUM = 2 + 4 + 6 + 8 + 10 + 12 + 14 + ... + 100.
Input Process Output
This problem has no Add all the even numbers from 2 Sum of even numbers up to
input to 100 100
e) Print a multiplication table of a given number.
Input Process Output
Number Initialize a variable to 1 and print its product with the Printing table
whose table is given number. Increment the variable by 1 and print the of the given
required product. Continue the process till printing the product of number
12 and the given number.
31
AQs
Q1. Define the problem and its types.
A problem is a challenge or situation that needs to be overcome using an action e.g. how to manage
limited budgets?
There are three types of problems.
• Decision Problems: A decision problem occurs when a given output requires a Binary
response, either Yes or No. For example, the problem is whether a given number is prime.
• Search Problems: A search problem involves finding a solution by exploring a set of
possibilities. You start from an initial state, move according to certain rules, and aim to
reach a goal state. For example: Finding a path from one city to another on a map.
• Counting Problems: A counting problem calculates the total combinations from different
categories. If one has A choices and another has B, the total combinations are A×B.
Example: With 5 shirts and 3 pants, you can make: 5 × 3 = 15 outfits. 5×3=15 outfits.
Q2. What is problem-solving?
Problem Solving:
32
Problem-solving is the process of analyzing a situation and accordngly behaving accordingly
to generate a solution or response.
Steps for Simple Problems:
1. Define the problem.
2. Design a solution (algorithm).
3. Implement the solution.
4. Evaluate
Example: Adding two numbers.
Steps for Complex Problems:
1. Define and analyze the problem.
2. Break it into sub-problems.
3. Explore multiple solutions for each sub-problem.
4. Select the best solution.
5. Implement the solution.
6. Evaluate
Example: Building a website with multiple functionalities.
Q3. What are the components of the IPO model, and how does an IPO chart help?
The IPO (Input-Process-Output) Model is a framework used to describe how a system
works. It breaks down the process into three key components:
• Input: The data or resources need to be given to the system
• Process: The operations or actions performed on the input.
• Output: The final result or information produced by the system.
IPO Chart:
An IPO Chart visually represents the IPO model in a tabular format by listing the inputs,
processes, and outputs of a system. It is commonly used by software designers to map out
how systems function.
Example IPO Chart (for calculating the area of a rectangle):
Input Process Output
Length, Width Area = Length × Width Area of rectangle
Q4. What is Logical and Algorithmic Thinking?
Logical Thinking:
Logical thinking is analyzing a problem using facts and reason to make sensible decisions.
For example, If you see water on the floor, you reason that the water might be from a spill or
a leak.
33
Algorithmic Thinking:
Algorithmic thinking involves breaking a problem into steps and creating a clear process to
solve it. For Example:
To find the largest of three numbers, compare them step by step:
Check if A > B, then check if A > C to find the largest.
Q5. What is a flowchart?
A flowchart is a visual representation of an algorithm, showing steps and decisions using
shapes like ovals (start/end) and rectangles (process). Flowchart shows the sequence of
operations which help to solve problems and also aids in finding and removing logical errors.
Symbol Meaning Purpose
Oval Start or End The oval represents the start or end of
the flowchart. Every flowchart must
begin and end with an oval.
Parallelogram Input or Output to The parallelogram shows where data is
flowchart inputted or outputted in a flowchart.
Rectangle Processing The rectangle is used for actions or
processes. It represents tasks like
calculations or steps that need to be
done.
Diamond Decision Making The diamond is used when a decision is
needed. It shows a point where the flow
can go in two or more directions, like
"Yes" or "No."
The flowchart given below calculates the sum, product and average of five numbers
34
Q6. What is a concept map?
A concept map is a visual tool that shows the relationships between different concepts using
labeled boxes or circles connected by arrows. It helps organize and understand how ideas are
related.
The first map shows viruses causing sickness and increasing death rates, reduced by hand
washing. The second shows sunshine leading to food production through cows eating grass.
Q7. List software tools for designing flowcharts.
• Microsoft Visio
• LARP Software
Q8. Draw a flowchart that reads a number and prints whether it is negative, positive or
zero.
35