Algorithms and Flow Charts
We will cover following topics
Algorithms And Flow Charts
From this section, three types of problems are asked:
(i) Write an algorithm
(ii) Draw a flowchart
(iii) Write a program in C++
Note: After the syllabus change in 2008, for programming related questions, the language is changed from BASIC to C++, so you may attempt the programming questions related to BASIC by simple writing the logic in C++ instead of BASIC.
Also, for students appearing for IFoS, since syllabus is not changed after 2008, so practice the programming-related questions in both BASIC and C++.
PYQs
Algorithms And Flow Charts
1) Draw a flow chart and write a basic algorithm (in FORTRAN/C/C++) for evaluating using Trapezoidal rule.
[2019, 10M]
2) Write down the basic algorithm for solving the equation: by bisection method, correct to 4 decimal places.
[2018, 10M]
3) In a certain examination, a candidate has to appear for one major & two major subjects. The rules for declaration of results are marks for major are denoted by and for minors by and . If the candidate obtains 75% and above marks in each of the three subjects, the candidate is declared to have passed the examination in first class with distinction. If the candidate obtains 60% and above marks in each of the three subjects, the candidate is declared to have passed the examination in first class. If the candidate obtains 50% or above in major, 40% or above in each of the two minors and an average of 50% or above in all the three subjects put together, the candidate is declared to have passed the examination in second class. All those candidates, who have obtained 50% and above in major and 40% or above in minor, are declared to have passed the examination. If the candidate obtains less than 50% in major or less than 40% in anyone of the two minors, the candidate is declared to have failed in the examinations. Draw a flow chart to declare the results for the above.
[2012, 20M]
4) Draw a flow chart for Lagrange’s interpolation formula.
[2011, 20M]
5) Given matrices
, . Draw programme outline, flow chart and also write a programme in BASIC to enable evaluation of , given .
[2007, 30M]
6) Draw a programme outline and a flow chart and also write a programme in BASIC to enable solving the following system of 3 linear equations in 3 unknowns , and : with , , .
[2006, 30M]
7) In a certain exam, candidates have to take 2 papers under part and 2 papers under part . A candidate has to obtain minimum of 40% in each paper under part , with an average of 50%, together with a minimum of 35% in each paper under part , with an aveage of . For a complete PASS, an overall minimum of 50% is required. Write a BASIC program to declare the result of 100 candidates.
[2004, 15M]
8) Write a BASIC program for solving the differential equation:
to get , for at an equal interval of 0.2, by Runge-Kutta fourth order method.
[2004, 15M]
9) Draw a flow chart and also write a program in BASIC to find one real root of the non linear equation by the fixed point iteration method. Illustrate it to find one real root, correct up to four places of decimals, of .
[2005, 30M]
10) A teacher conducts three tests TEST 1, TEST 2 and FINAL for 50 marks each. Out of the marks scored in the two tests, TEST 1 and TEST 2, he takes the better one and adds to the marks scored in FINAL, so that the total marks scored will be for a maximum 100.
The letter grades will be assigned depending on the amrks scored as per the following norm:
0-39:
40-49:
50-59:
60-74:
70-100:
For each student data consisting of name, scores in TEST 1, TEST 2 and FINAL are given. Write a program in BASIC which will print out the names, total marks scored and grade obtained for all 20 students in a class.
[2002, 20M]
11) Draw a flow chart to examine whether a given number is a prime.
[2002, 10M]
12) Write a computer program in BASIC to evaluate the polynomial
for values of .
[2001, 15M]
13) In an examination students are awarded letter grades according to the following scheme:
| Score Range | Letter Grade |
|:------------------------|:-------------|
| Score$\geq$90 | A |
| $80\geq$Score$<$90 | B |
|$70\geq$Score$<$80 | C |
|$60\geq$Score$<$70 | D |
| Score$<$60 | F |
For each score print a message identifying the letter grade. For grade an additional message ‘This is a falling case’ may be mentioned. Prepare the flowchart for this scheme and write the program in BASIC.
[20M]