0% found this document useful (0 votes)
43 views16 pages

Comutational Thinking Worksheets

ICT THINKG

Uploaded by

himankagarwal61
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views16 pages

Comutational Thinking Worksheets

ICT THINKG

Uploaded by

himankagarwal61
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Unit 1: Computational Thinking

Learning Objectives
Learners will learn to:
 follow, understand, edit and correct algorithms that are presented as flowcharts

 know how to create algorithms using flowchart symbols

 select and use appropriate comparison operators in algorithms, limited to <,>,

<=, >=, == (equal to) and != (not equal to)

 follow and understand the logic of AND, OR, NOT

 identify errors in a given algorithm/flowchart and suggest ways of correcting

these errors

 understand and use selection statements, limited to IF, THEN, ELSE, presented

as flowcharts

 select and use appropriate constructs in algorithms written as flowcharts,

limited to sequence and selection

 predict the outcome of flowcharts that use selection

Vocabulary
Flowchart
blueprint
sequence
selection

Let Us Start

I am having some trouble figuring


out how to perform the task I approach the task systematically and
efficiently. I keep running into make sure that each step is well‐
errors and getting the wrong defined and contributes to the overall
results. What are you doing goal. I also make sure that the inputs
differently to avoid errors? and outputs are clearly defined.

1
Let Us Explore
Remove any three matchsticks to leave only three squares.

To get the desired result, think in a stepwise manner. You can create an algorithm to

get the desired result. It is important to be careful and precise when developing an

algorithm. A single mistake can cause errors and produce the wrong results.

Get, Set, Go
1.1 Using flowchart
A flowchart is a pictorial representation of an algorithm that provides a detailed and

organized overview of its steps. It uses symbols to represent various statements within

the algorithm. The flowchart is designed from top to bottom to depict the exact

sequence of steps, which makes it an effective blueprint for solving a problem.

We must follow some rules while drawing a flowchart from an algorithm. The rules

include:

1. Identify the input and output of the algorithm. This step is essential as it helps

us understand what data is being fed into the algorithm and what results are

expected.

2. Identify the steps of the process. This step requires careful analysis of the

problem to determine the sequence of actions needed to produce the desired

output.

3. Draw a flowchart using appropriate symbols that accurately represent the

various stages of the algorithm.

2
1.2 Flowchart symbol
Flowchart symbols are geometrical shapes used to represent different elements of an

algorithm. These symbols are interconnected by arrow lines to illustrate the flow of the

sequence. Using geometric shapes in the flowchart ensures that the sequence of

operations is accurately represented, making it an effective tool for visualizing

algorithms.

Flowchart Geometric Purpose


symbol shape
Ellipse Start/ End box
It is used to indicate the starting or ending of a
sequence. It is used at the beginning and end
of the flowchart.
Parallelogram Input/output box
It represents the inputs required for the process
or outputs of the process.
Rectangle Processing box
It represents the actual processing part of the
flowchart, such as a calculation.
Diamond Decision box
It is used to check the conditions, compare, and
decide to solve the problem based on the
outcome. A diamond shape always contains a
question. The next step in the sequence is
based on the answer to the question, either
‘yes’ or ‘no’.
Arrows Flowline
These arrow lines connect the different shapes
showing the flow of logic in a flowchart.
Circle Connector
C It is used to show the continuation of a
flowchart at a different place.

Tech Tickler

A variable is the name of the data input to the system. It keeps on changing
its value during the execution of the program. Its value can be incremented
and decremented as per the requirement.
3
Example 1
An algorithm and flowchart to find the sum of two numbers.
Algorithm
Step 1: Start

Step 2: Input num1 and num2

Step 3: Find the sum of num1 and num2 and store it in Sum

Step 4: Display the Sum of two numbers

Step 5: Stop
Flowchart

Start

Accept value in num1

Accept value in num2

Sum=num1+num2

Display Sum

End

Output
 If the user enters num1 = 9 and num2 = 10, the sum of the two numbers will

be 19.

 If the user enters num1= a and num2 = b, the algorithm will not work. Instead,

it will give an error as letters are supplied instead of numbers for variables

num1 and num2.


4
Activity 1
Use the algorithm of finding the sum of two numbers and make the necessary

changes to find the sum of the three numbers. Then, create a flowchart for the

algorithm.

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

Flowchart

5
Check For Understanding
Draw a flowchart for the given algorithm to find the area of a circle.
Step 1: Start

Step 2: Read the value of the radius of the circle

Step 3: Calculate the area using the formula: area = π * radius^2

Step 4: Display the calculated area

Step 5: Stop

Flowchart

1. Predict the output if the following values are entered for the radius.

a. 6 - _________________________

b. 2.5 - _______________________

Assignment
1. Explore and find the options in MS Word to draw a flowchart.

2. Explore and mention the open-source software used to draw a flowchart. One

of the commonly used open-source software is OpenOffice Writer.

6
1.3 Using operators
Operators allow us to manipulate and combine values to produce desired results. Let

us look into some of the operators.


Comparison operators
Comparison operators are used to compare values or expressions in programming.

They return either true or false based on the comparison result. Here are the

commonly used comparison operators:

Operator Explanation Example Result

If x=5, y =10

Equal to (==) Checks if two values or (x == y) false

expressions are equal

Not equal to (!=) Checks if two values or (x != y) true

expressions are not equal

Greater than (>) Checks if the left operand is (x > y) false

greater than the right operand

Less than (<) Checks if the left operand is less (x < y) true

than the right operand

Greater than or Checks if the left operand is (x >= y) false

equal to (>=) greater than or equal to the

right operand

Less than or Checks if the left operand is less (x <= y) true

equal to (<=) than or equal to the right

operand

Logical operators
Logical operators are used to join two or more variables or conditions. These are

used in conditional statements and return either true or false as output.

7
Operator Explanation Example Result

If x=5, y =10

AND Returns true if both operands are ((x>5) && (y=10)) false

(&&) true, otherwise returns false.

OR (||) Returns true if at least one of the ((x>5) || (y=10)) true

operands is true, otherwise returns

false.

NOT (!) Returns the opposite boolean !(5>10) true

value of the operand. If the

operand is true, it returns false; if

the operand is false, it returns true.

1.4 Using selection


When you come across a point in a program with multiple choices, you have to make

a selection. The program then asks questions and selects a specific path based on the

answers received.

A selection statement is used when an algorithm needs to make a decision. It often

has the key commands ‘IF’, ‘THEN’ and ‘ELSE’. The three parts of the selection

statements are:

• condition: The condition (can only be true or false).

• true: The action that happens if the condition is true.

• false: The action that happens if the condition is false

In flowcharts, the selection is represented using the diamond-shaped symbol. The

diamond has two arrows that come from it. One arrow is followed when the condition

is True (or yes). The second is followed when the condition is False (or no).

yes/true
IS A < B?

no/false
8
Example 1
An algorithm and flowchart to find the profit or loss for a given cost price and selling

price.
Algorithm
Step 1: Start

Step 2: Accept the value of the cost price and store it in CP

Step 3: Accept the value of the selling price and store it in SP

Step 4: Check whether SP>CP. If Yes, calculate the profit as SP-CP and then

print it. Then, go to step 5. If not, calculate the Loss as CP-SP.

Step 5: End
Flowchart

Output
 If the user enters CP = 100 and SP =150, The decision box checks if SP<CP

and calculates the profit. It then displays Profit.

 If the user enters CP = 200 and SP =170, The decision box checks if SP<CP

and calculates the loss. It then displays Loss.

9
Example 2
An algorithm and flowchart to find if a number is both positive and even:
Algorithm
Step 1: Start

Step 2: Read the number

Step 3: If the number is greater than 0 AND the number modulo 2 is equal to 0, then

Display "Number is positive and even."

else

Display "Number is not positive and even."

Step 4: End

Flowchart

10
Check For Understanding
Draw a flowchart for the given algorithm to check the driver's age before issuing the

driving license.

Step 1: Start.

Step 2: Accept the value in age.

Step 3: If age< 18, then go to Step 5.

Step 4: Print ‘eligible for driving’, then go to Step 6.

Step 5: Print ‘not eligible for driving’.

Step 6: Stop.

Flowchart

• What is the purpose of the flowchart?


______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________

11
• What will be the output of the flowchart if the user enters the age as 25?
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________

Editing and correcting flowcharts


You may be given a flowchart that does not work as it should. Identifying and

correcting errors in an algorithm/flowchart ensures that the program or process

performs its intended function correctly. You must trace the algorithm yourself before

you identify and correct the error. You must walk through the flowchart one step at a

time to discover what it does.


Correcting errors
When creating the algorithm/flowchart, follow the checklist to ensure you have met

the requirements. If these requirements are met, then it is time to test your flowchart.

Predict the output, then run the flowchart to see if it works correctly.

If it is not working out as expected, then look at the output you got and the expected

output. Identify the difference and then find the error.

Requirements checklist

Is there a start and a stop?

Are all inputs and outputs in the correct shape?

Are all processes in the correct shape?

Does each input, output and process have one data flow arrow

going in and one going out?

Do all the boxes lead to another box?

If you have used a variable, have you used the same name

consistently?

Have you used the correct mathematical symbols (+, -, *, /)?

Have you used a variety of data to check for the desired output?

12
Activity 2
Write an algorithm to find the area of a rectangle. Use the different sets of data, i.e.,

valid and invalid data to test the algorithm.

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

Unit Review
1. A flowchart is a pictorial representation of an algorithm that provides a

detailed and organized overview of its steps.

2. While drawing a flowchart from an algorithm, we must identify the input and

output of the algorithm, identify the steps of the process and then draw a

flowchart using appropriate symbols.

3. A flowchart uses different geometrical shapes to represent different elements

of an algorithm.

4. Operators such as comparison operators and logical operators are used to

perform calculations in an algorithm and flowchart.

13
5. A selection statement is used when a decision needs to be made in an

algorithm. It has a condition.

6. Identifying errors in an algorithm is an important step in ensuring that the

program or process performs its intended function correctly.

7. When creating the algorithm/flowchart, follow the checklist to ensure you

have met the requirements.

Check for Understanding


Select the correct option
1. What does a flowchart use to represent statements of the algorithm?

a. Numbers

b. Words

c. Symbols

d. Lines

2. What is the first step in drawing a flowchart from an algorithm?

a. Analyzing the problem

b. Identifying the input and output of the algorithm

c. Deciding on the sequence of actions

d. Drawing the flowchart

3. What is the significance of analyzing the problem while drawing a flowchart?

a. It helps to determine the input and output of the algorithm

b. It helps to identify the steps of the process

c. It helps to determine the appropriate symbols for the flowchart

d. It helps to understand the problem and how to solve it

14
4. What is the benefit of visualizing an algorithm using a flowchart?

a. It makes the algorithm more complicated

b. It makes the algorithm more difficult to understand

c. It provides an effective tool for understanding and communicating the

algorithm

d. It slows down the process of solving the problem

5. What is an example of using test data for an algorithm that calculates the area of

a rectangle?

a. Providing only one set of width and height values

b. Providing only valid data

c. Providing extreme values that are not realistic

d. Providing a range of width and height values to test different inputs

Project Work
Draw a flowchart for the algorithm to find the largest of the three numbers.
Step1: Start

Step 2: Input three numbers a, b, c

Step 3: If a is greater than b and a is greater than c, then display "a is the largest

number" Go to step 4. Else if b is greater than a and b is greater than c, then display

"b is the largest number" Go to step 4. Else Display "c is the largest number" End if

Step 4: Stop

Flowchart

15
Lab Work
1. Perform the following tasks.
a. Write an algorithm to accept a person's age and check whether he/she is

eligible to vote. A person is eligible to vote only when he/she is 18 years or

more.

b. Draw a flowchart for the algorithm in MS Word.

c. Create and use checklist to identify any errors in the algorithm and

flowchart.

d. Use the variety of data to predict the output.

Resources: Reference Material:

https://www.programiz.com/article/flowchart-programming https://www.youtube.com/watch?v=XFCAjHGZgGI

16

You might also like