Textual Questions and Exercises
REVIEW QUESTIONS AND EXERCISES
1. Average of Three Values
Write the algorithm and draw the flowchart to find the average of given 3 values.
Answer:
1. Read n1, n2 and n3, where n represents number
2. avr = (n1 + n2 + n3) / 3
3. print avr
Flowchart:
2. Circle Area and Circumference
Write the algorithm and draw the flowchart to find the area and circumference of a circle of radius r.
Hint: Area= πr²; Circumference = 2πr
Answer:
1. Read r
2. Area = 22/7 * r*r, Circumference = 2*22/7*r
3. Print Area, Circumference
Flowchart:
Circumference = 2*22/7*r
3. Temperature Conversion
Write the algorithm and draw the flowchart to convert the temperature given in °C to °F.
Hint: Use the relation °F= 1.8°C +32
Answer:
1. Read c
2. f = 1.8 * c + 32
3. Print f
Flowchart:
4. Smallest of Three Numbers
Draw the flowchart to find the smallest of the given three numbers.
Answer:
5. Cosine Series Summation
Draw the flowchart to solve the following series which is the summation of cosine series:
s = x - x²/2! + x⁴/4! - x⁶/6! + ... ∞
neglecting the terms which are less than 10⁻⁴ in magnitude.
Answer:
Hint: The method discussed in Example 8 can be used to solve this series with minor changes.
6. Sum of Natural Numbers
Draw the flowchart to find the sum of natural numbers up to N.
Hint: The method discussed in Example 10 can be used to solve the series, i.e. s = 1 + 2 + 3 + 4 + ... + N.
Answer:
7. Factorial Series
Draw a flowchart to solve the following series:
s = 1 + 1/2! + 1/3! + 1/4! + ... + 1/N!
Answer:
8. Exponential Series (eˣ)
Draw a flowchart to solve the following series:
eˣ = 1 + x + x²/2! + x³/3! + x⁴/4! + ... ∞
Neglect the terms which are less than 10 in magnitude.
Answer:
SHORT QUESTIONS
1. What is an algorithm?
Answer: An algorithm presents step-by-step instructions required to solve any problem.
2. What is a flowchart?
Answer: Flowchart is a symbolic or diagrammatic representation of an algorithm.
3. _______ programming method is followed in C language.
Answer: Procedural
4. _______ programming method is followed in C++.
Answer: Object-Oriented
5. Procedural programming method is commonly used for writing small programs which produce discrete results. (True/False)
Answer: True
6. Object-oriented programming method is commonly used to develop software packages to perform a task. (True/False)
Answer: True
7. Algorithms and flowcharts may be omitted after getting experience in writing program. (True/False)
Answer: False