Algorithms and Flowcharts

This page contains the CBSE Computer Science with Python class 11 Unit-2 chapter 1 Algorithms And Flowcharts. You can find the solutions for chapter 1 of CBSE class 11 Computer Science with Python Exercise. So is the case if you are looking for CBSE class 11 Computer Science with Python related topic Algorithms And Flowcharts questions and answers for the Exercise.
Exercise
Multiple Choice Questions
Question 1
1. A step by step method for solving a problem using English Language
(a)
program
(b)
Flowchart
(c)
statement
(d)
Algorithm ✔
Answer 1
Correct option: (d) Algorithm.
An algorithm is a step-by-step method written in simple language to solve a problem.
Question 2
2. Set of statements is executed based upon conditional test.
(a)
Looping
(b)
Selective ✔
(c)
Sequence
(d)
None
Answer 2
Correct option: (b) Selective.
In selective statements, execution path depends on a condition (for example, if-else).
Question 3
3. Set of statements is executed again and again based upon conditional test.
(a)
Looping ✔
(b)
Selective
(c)
Sequence
(d)
None
Answer 3
Correct option: (a) Looping.
Looping means repeating a set of statements while a condition remains true.
Question 4
4. The graphical representation of algorithm is
(a)
program
(b)
Flowchart ✔
(c)
statement
(d)
Algorithm
Answer 4
Correct option: (b) Flowchart.
A flowchart is the graphical representation of an algorithm using standard symbols.
Question 5
5. All instructions are executed one after other.
(a)
Looping
(b)
Selective
(c)
Sequence ✔
(d)
None
Answer 5
Correct option: (c) Sequence.
In sequence control structure, statements are executed one after another in order.
Answer the following questions.
Question 1
1. Define Algorithm.
Answer 1
An algorithm is a step-by-step procedure used to solve a problem in a logical and systematic way. It describes the sequence of actions that should be followed to reach the correct result.
An algorithm is written in simple language so that each step can be understood clearly and carried out in the proper order. It helps in planning the solution before writing the actual program. Thus, an algorithm makes problem-solving easier, more organized, and less confusing.
Question 2
2. Define Flowchart.
Answer 2
A flowchart is the graphical or diagrammatic representation of an algorithm. It shows the steps of solving a problem by using standard symbols connected with arrows or lines. These arrows indicate the flow of control from one step to another.
A flowchart makes the logic of a problem easier to understand because the solution is shown in a visual form. It helps in planning the sequence of operations clearly before writing the program. Thus, a flowchart is a useful tool for representing the logic of a program in a simple and organized manner.
Question 3
3. Write an algorithm to find the sum of two numbers.
Answer 3
Algorithm to find the sum of two numbers:
Step 1:
Start
Step 2:
Input two numbers and store them in A and B
Step 3:
Calculate SUM = A + B
Step 4:
Display SUM
Step 5:
Stop
This algorithm is simple and follows the sequence of input, processing, and output. First, the two numbers are entered, then they are added, and finally the result is displayed. This makes the logic clear and easy to follow.
Question 4
4. Write an algorithm to find the area of a triangle.
Answer 4
Algorithm to find the area of a triangle:
Step 1:
Start
Step 2:
Input the base and height of the triangle
Step 3:
Calculate AREA = (base * height) / 2
Step 4:
Display AREA
Step 5:
Stop
This algorithm uses the standard formula for finding the area of a triangle, that is:
Area = 1/2 x base x height
First, the required values, namely base and height, are entered. After that, the area is calculated using the formula. Finally, the computed area is displayed. This algorithm is simple and follows a proper sequence of input, processing, and output, which makes it easy to understand and use.
Question 5
5. Write an algorithm to find whether given number is odd or even.
Answer 5
Algorithm to find whether a given number is odd or even:
Step 1:
Start
Step 2:
Input a number and store it in N
Step 3:
Check whether N % 2 = 0
Step 4:
If the condition is true, display “Even Number”
Step 5:
Otherwise, display “Odd Number”
Step 6:
Stop
This algorithm checks the remainder when the number is divided by 2. If the remainder is 0, the number is even. If the remainder is not 0, the number is odd. In this way, the algorithm uses a simple decision step to determine the correct result.
It is easy to understand because it follows a proper order of input, checking the condition, displaying the result, and stopping.
Question 6
6. Write an algorithm to find the sum of all even number up to given number.
Answer 6
Algorithm to find the sum of all even numbers up to a given number:
Step 1:
Start
Step 2:
Input a number and store it in N
Step 3:
Set I = 2 and SUM = 0
Step 4:
Check whether I <= N
Step 5:
If true, calculate SUM = SUM + I
Step 6:
Increase I by 2
Step 7:
Go back to Step 4
Step 8:
Display SUM
Step 9:
Stop
This algorithm adds only the even numbers starting from 2 up to the given number. The variable I is increased by 2 each time, so only even values are taken. In this way, unnecessary checking of odd numbers is avoided.
It follows a proper sequence of input, initialization, repetition, calculation, and output. After all even numbers up to N are added, the final sum is displayed.
Question 7
7. Draw a flowchart to find the area of a circle.
Answer 7
A flowchart to find the area of a circle shows the steps in a visual sequence. For this, the radius of the circle is taken as input, then the area is calculated using the formula:
Area = π × R2
After calculating the value, the result is displayed. This is a simple sequential flowchart because all the steps are performed one after another.
Flowchart steps
Start
Input radius R
ProcessAREA = π × R2
DisplayAREA
Stop
Flowchart
Flowchart to find the area of a circleStart symbolStartInput symbol: read radius RInput RProcess symbol: AREA = π × R²AREA = π × R²Output symbol: display AREADisplay AREAStop symbolStopFlow arrow: Start to InputFlow arrow: Input to ProcessFlow arrow: Process to OutputFlow arrow: Output to Stop
Text form of flowchart
Start -> Input R -> Calculate AREA = π × R2 -> Display AREA -> Stop
This flowchart clearly shows the order of input, processing, and output, which makes the logic easy to understand.
Question 9
9. Draw a flowchart to find the smallest number among n numbers.
Answer 9
To find the smallest number among n numbers, the flowchart should compare the numbers one by one and keep track of the smallest value found so far. The first number is taken as the initial smallest number, and then each remaining number is compared with it. If a smaller number is found, that value replaces the current smallest number. This process continues until all the numbers have been checked.
Flowchart steps
Start
InputN (the total number of numbers)
Input the first number and store it in SMALL
Set I = 2
Input the next number into NUM
Check whether NUM < SMALL
If Yes, set SMALL = NUM
Increase I by 1
Check whether I <= N
If Yes, repeat the process from inputting the next number
If No, DisplaySMALL
Stop
Flowchart
Flowchart to find the smallest number among n numbersStartStartInput NInput NInput first number into SMALLInput first number into SMALLSet I = 2Set I = 2Input NUMInput NUMDecision NUM < SMALLNUM < SMALL?Process SMALL = NUMSMALL = NUMProcess I = I + 1I = I + 1Decision I &lt= NI <= N?Display SMALLDisplay SMALLStopStopMain flowYes branch for NUM < SMALLYesNo branch for NUM < SMALLNoFlow to second decisionYes branch loop backYesNo branch to output and stopNo
Text form of flowchart
Start -> Input N -> Input first number into SMALL -> Set I = 2 -> Input NUM -> Is NUM < SMALL? -> If Yes, SMALL = NUM -> I = I + 1 -> Is I <= N? -> If Yes, repeat -> If No, Display SMALL -> Stop
This is an iterative flowchart because the comparison step is repeated until all n numbers are checked. At the end, the value stored in SMALL will be the smallest number among all the entered numbers.
Question 10
10. Draw a flowchart to find the sum of all multiples of 5 up to given number.
Answer 10
To find the sum of all multiples of 5 up to a given number, the flowchart should repeatedly add only those numbers that are divisible by 5. Instead of checking every number one by one, the process can begin from 5 and increase by 5 each time. This makes the logic simpler and more efficient.
Flowchart steps
Start
InputN
Set I = 5 and SUM = 0
Check whether I <= N
If Yes, calculate SUM = SUM + I
Increase I by 5
Go back and check the condition again
If No, DisplaySUM
Stop
Flowchart
Flowchart to find the sum of all multiples of 5 up to given numberStartStartInput NInput NSet I=5 and SUM=0I = 5, SUM = 0Decision I <= NI <= N?Process SUM = SUM + ISUM = SUM + IProcess I = I + 5I = I + 5Display SUMDisplay SUMStopStopMain flowYes branchYesNo branchNo
Text form of flowchart
Start -> Input N -> Set I = 5, SUM = 0 -> Is I <= N? -> If Yes, SUM = SUM + I -> I = I + 5 -> Repeat -> If No, Display SUM -> Stop
This is an iterative flowchart because the same steps are repeated until all multiples of 5 up to the given number are added. At the end, the value stored in SUM gives the required total.
Question 11
11. Mona is confused about finite loop and infinite loop, explain her with the help of example.
Answer 11
A finite loop is a loop that runs for a limited number of times and then stops when the given condition becomes false. An infinite loop is a loop that keeps running continuously because its condition never becomes false. In looping, a set of statements is executed again and again based on a condition.
Finite loop
A finite loop has a proper ending condition. After a certain number of repetitions, control comes out of the loop.
Example:
I = 1
While I <= 5
Print I
Set I = I + 1
In this example, the loop prints the values from 1 to 5 and then stops. This is called a finite loop because it ends after a fixed number of iterations.
Infinite loop
An infinite loop does not stop on its own because the condition remains true continuously.
Example:
I = 1
While I > 0
Print I
In this example, the condition I > 0 remains true if the value of I is not changed properly. So, the loop keeps running again and again. This is called an infinite loop.
Flow Diagram
Finite loop vs Infinite loop flow diagramsFinite loop panelFinite LoopStartI = 1I <= 5 ?Print II = I + 1StopYesNoInfinite loop panelInfinite LoopStartI = 1I > 0 ?Print IYesCondition stays true, loop continues
Thus, a finite loop has a stopping point, whereas an infinite loop continues without ending until it is stopped manually or the program is interrupted.
Question 12
12. Write an algorithm and a flowchart to find sum of n numbers.
Answer 12
To find the sum of n numbers, the logic should repeatedly take each number as input, add it to a running total, and continue this process until all the numbers have been entered. This uses iteration, because the same steps are repeated until the required count is completed.
Algorithm to find sum of n numbers
Step 1:
Start
Step 2:
Input N (the total number of numbers to be added)
Step 3:
Set SUM = 0 and I = 1
Step 4:
Input a number and store it in NUM
Step 5:
Calculate SUM = SUM + NUM
Step 6:
Increase I by 1
Step 7:
Check whether I <= N
Step 8:
If Yes, go to Step 4
Step 9:
If No, display SUM
Step 10:
Stop
This algorithm first takes how many numbers are to be added. Then it starts with SUM = 0 and keeps adding each entered number to SUM. The counter I helps in keeping track of how many numbers have already been added. When all N numbers are processed, the final sum is displayed.
Flowchart steps
Start
InputN
Set SUM = 0, I = 1
InputNUM
ProcessSUM = SUM + NUM
ProcessI = I + 1
Check whether I <= N
If Yes, repeat from inputting the next number
If No, DisplaySUM
Stop
Flowchart
Flowchart to find sum of n numbersStartInput NSUM = 0, I = 1Input NUMSUM = SUM + NUMI = I + 1I <= N?Display SUMStopYesNo
Text form of flowchart
Start -> Input N -> Set SUM = 0, I = 1 -> Input NUM -> SUM = SUM + NUM -> I = I + 1 -> Is I <= N? -> If Yes, repeat -> If No, Display SUM -> Stop
This is an iterative flowchart because the input and addition steps are repeated until all the numbers are included. In the end, the value stored in SUM gives the total of the n numbers.