advertisement

14.04.2004 9.00 - 12.00 LOYOLA COLLEGE (AUTONOMOUS), CHENNAI –600 034 B.Sc., DEGREE EXAMINATION - STATISTICS FOURTH SEMESTER – APRIL 2004 ST-4202/STA202 - NUMERICAL METHODS USING 'C' Max:100 marks SECTION -A (10 2 = 20 marks) Answer ALL questions 1. What is an assignment statement? What is the relationship between an assignment statement and an expression statement? 2. Mention the difference between pre-increment and post-increment operator. 3. Give the syntax of ternary operator. 4. What is the output of the following program segment? for (i = 0, j = 0; i < = 5; i ++, j ++) print f (" %d\ n", i+j); 5. Mention the difference between break and continue statement. 6. What is an array? 7. Comment on the following statement: " scanf () and get char() functions are equivalent". 8. Find the value of f (10) using Lagrange's linear interpolation for the following function: x: 7 19 f: 15 35. 1. 2 9. Evaluate f ( x) dx using Trapezoidal rule where f(x) is defined as 0 .8 x: 0.8 0.9 1.0 1.1 1.2 f: 0.71736 0.78333 0.84147 0.92314 0.96356 10. Give the steps to find the root of an equation by Newton-Raphson method. SECTION - B (5 8 = 40 marks) Answer any FIVE questions 11. a) Explain the data types available in C. b) What are type qualifiers? (6+2) 12. Explain the concept of branching and looping with examples. 13. Explain the syntax of the following: a) printf() b) toupper() c) pow() d) floor() 1 14. Give the output of the following program segments: a) i = x = 0; b) x = 0; do for (i = 0; i<5; i++) { { if (i% 5 = =0) for (j = 0; j<i;j++) { { x++; switch (i+j-1) printf("%d \n”, x); { } case -1: i++; case 0: x = x+1; }while (i<20); break; printf ("%d'1' x); case 1: case 2: case 3: x = x+2; break; default: x = x+3; break; } printf ("%d\n", x); } } (3+5) 15. a) Write a program to accept an integer and display it in reverse order. b) Write a program using function to find the factorial of a given positive integer. (4+4) 16. Find the determinant of the following matrix by pivotal condensation method. 1 1 A 3 1 1 0.5 1 2 0 1 1 2 1 0 0 2 17. Write a program to solve the equation x2+3x-5=0 using bisection method. 18. Write a program to find the largest eigen vector by the method of iteration. SECTION - C Answer any TWO questions 19. a) Explain the structure of a C program. b) Write a program to find the maximum among 'n' given integers. c) Explain the concept of arrays with an example. (2 20 = 40 marks) (6+6+8) 20. a) Write a program to find the roots of a quadratic equation of the form ax2+bx+c=0. b) Write a program to find the sum of 2 square matrices of order mxm. c) What are user defined functions? Explain the method of declining and defining a user defined function. (6+6+8) 2 21. a) Explain the Gauss-elimination method to solve a given set of simultaneous equation and write a program for the same. 0. 8 b) Evaluate (log ( x 1) sin 2 x)dx using simpson's 1/3 rule by taking h as 0.1. (12+8) 0 22. a) Write a program using Lagrange's interpolation method to evaluate f(y) where 'f' is a function defined as x : x1 x2 ........xn f(x): f1 f2 ........fn Assume that x1, x2.....xn, f1, f2,......fn are known values. b) Find the inverse of the following matrix by Gauss-Jordon elimination method. 4 3 1 A = 1 1 1 3 5 3 (12+8) 3