Link Search Menu Expand Document

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 \(y=\int^6_0 \dfrac{\,dx}{1+x^2}\) using Trapezoidal rule.

[2019, 10M]


2) Write down the basic algorithm for solving the equation: \(xe^x-1=0\) 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 \(M_{1}\) and for minors by \(M_{2}\) and \(M_{3}\). 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 \(3 \times 3\) matrices

\(A=(a_{ij})\), \(B=(b_{ij})\). Draw programme outline, flow chart and also write a programme in BASIC to enable evaluation of \(F\), given \(F=5*(A+B)*(A-B)\).

[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 \(x_{1}\), \(x_{2}\) and \(x_{3}\): \(C * X=D\) with \(C=\left(c_{i j}\right)_{i, j=1}^{3}\), \(X=\left(x_{j}\right)_{j=1}^{3}\), \(D=\left(d_{i}\right)_{i=1}^{3}\).

[2006, 30M]


7) In a certain exam, candidates have to take 2 papers under part \(A\) and 2 papers under part \(B\). A candidate has to obtain minimum of 40% in each paper under part \(A\), with an average of 50%, together with a minimum of 35% in each paper under part \(B\), with an aveage of \(40%\). 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:

\[\dfrac{dy}{dx}=x^2+y^2, y(0)=0.1\]

to get \(y(x)\), for \(0.2 \leq x \leq 5\) 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 \(x=\phi(x)\) by the fixed point iteration method. Illustrate it to find one real root, correct up to four places of decimals, of \(x^{3}-2 x-5=0\).

[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: \(E\)
40-49: \(D\)
50-59: \(C\) 60-74: \(B\) 70-100: \(A\)

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

\[a_0x^n+a_1x^{n-1}+a_2x^{n-2}+ \cdots + a_{n-1}x+a_n\]

for values of \(x=1.2\) \((0.2)\) \(2.0\).

[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 \(F\) an additional message ‘This is a falling case’ may be mentioned. Prepare the flowchart for this scheme and write the program in BASIC.

[20M]


< Previous Next >


Back to top Back to Top

Copyright © 2020 UPSC Maths WebApp.