MENU

Chapter 6 Algorithms and Flowcharts Solutions

Question - 11 : -
Differentiate between top down and bottom up methods of modular programming.

Answer - 11 : -

Top-Down Method

Bottom-up Method

The principle of top down method dictate that a program should be divided into a main module and its related module. Each module should also be divided into sub modules according to software engineering and programming style. The division continues till the module consists only of an elementary process that is intrinsically understood and cannot be further sub­divided.

Bottom-up method is just the opposite of top- down method. It refers to a style of programming in which an application is constructed with existing primitives of the programming language and then gradually more and more complicated features are added till applications are written. In other words, initiating the design with simple modules and then fuild them into more complex structures ending at the top is bottom-up method.

Question - 12 : -
What are the advantages of using a modular approach in programming ?

Answer - 12 : -

  1. It is easy to understand small sections of code in the modular programming.
  2. You can store the code across multiple files.
  3. Modular programming allows collaborative programming. Collaborative programming means more’ than one program
  4. work in one application at the same time.
  5. Duplication of code, is not possible in modular programming. The programmers create a single procedure for code.
  6. The errors are localized to a subroutine or function and it is easy to find the errors.
  7. The code should be used in multiple applications in modular programming.
  8. The code should be simple and short in modular programming and it is less need to be written.

Question - 13 : -
Explain Algorithm.

Answer - 13 : - An algorithm is a step by step instructions required to solve any problem. These instructions are in user’s language that means they are independent of any programming language.

Question - 14 : -
Write some properties of algorithm.

Answer - 14 : -

Some properties of algorithm are :

  1. An algorithm should terminate after finite number of steps.
  2. An algorithm should be simple so that anyone can understand them properly.
  3. An algorithm should be universal and lead to an unique solution of the problem.
  4. An algorithm should have capability to handle some unexpected situations which may arise during the solution of a particular problem.
  5. An algorithm should be able to solve all problems of a particular type for which it is designed.

Question - 15 : -
Write some characteristics of algorithm.

Answer - 15 : -

Some characteristics of algorithm are :

  1. Each and every instruction should be short and clear.
  2. Each instruction should be such that it can be performed in a finite time.
  3. One or more instructions should not be repeated infinitely.
  4. After performing the instructions the desired result must be obtained.

Question - 16 : -
Write an algorithm to calculate sum of two numbers.

Answer - 16 : -

Step 1 : Start.
Step 2 : Read A,B.
Step 3: Sum=A+B.
Step 4 : Print Sum.
Step 5 : Stop.

Question - 17 : -
Write an algorithm to calculate simple interest.

Answer - 17 : -

Step 1: Start.
Step 2 : Read RR,T.
Step 3 : SI=(P*R*T)/100.
Step 4 : Print SI
Step 5 : Stop.

Question - 18 : -
Write an algorithm to convert temperature from Fahrenheit to Celsius.

Answer - 18 : -

Step 1: Start.
Step 2 : Read F.
Step 3: C=(5(F-32))/9.
Step 4 : Print C.
Step 5 : Stop. 

Question - 19 : -
Write an algorithm to calculate area of triangle.
 

Answer - 19 : -

Step 1: Start.
Step 2 : Read a,b,c.
Step 3: s=(a+b+c)/2.
Step 4 : Area = (s(s-a)(s-b)(s-c))1/2.
Step 5 : Print Area.
Step 6 : Stop. 

Question - 20 : -
Write an algorithm that generates the fibbonacci series as:
1,1,2,3, 5,…. N terms.

Answer - 20 : -

The algorithm as :

Step 1 : Begin.
Step 2 : Read N.
Step 3 : Let a = 1, b = 1 Step 4 : Print a, b.
Step 5 : ctr = 2.
Step 6 : c = a + b.
Step 7 : a = b.
Step 8 : b = c.
Step 9 : ctr = ctr + 1.
Step 10 : If ctr < N then repeat steps 6 to 9.
Step 11 : Stop. 

Free - Previous Years Question Papers
Any questions? Ask us!
×