LOYOLA COLLEGE (AUTONOMOUS), CHENNAI600 034. M.Sc. DEGREE EXAMINATION STATISTICS SECOND SEMESTER APRIL 2003 ST 2803/ S 818 PROGRAMMING LANGUAGES 28.04.2003 1.00 4.00 Max: 100 Marks PART A (10 2 = 20 Marks) Answer ALL the questions 01. What is the output of the following program? # include < iostream. h> void main ( ). { int x, y, z; x =10; y = x++; z = ++y; cont <<y <<z; } 02. Explain the switch structure. 03. Write a program to get the output as 1 2 3 4 2 3 4 5 3 4 5 4 5 5 5 04. Write a recursive program to get the factorial of a number. 05. What is prototyping? 06. What is encapsulation? 07. Explain destructor. 08. What is a pointer variable? 09. What is the use of the dot operator and scope resolution operator while using a class? 10. Explain strcpy ( ), strcat ( ) PART B (5 8 = 40 Marks) Answer any FIVE questions. 11. Explain constructors with examples. 12. Explain structures with examples. 13. Write a program to find the largest element in a matrix. 1 14. Illustrate how runtime polymorphism is achieved with the help of virtual functions. 15. Explain the following i) ios : : in, ii) ios : : out iii) ios : : ate iv) ios : : no create v) ios: : bin vi) ios : : no replace. (6 1 ½) 16. Illustrate the use of default arguments. 17. Illustrate with an example the use of friend functions. 18. Explain with an example passing objects as arguments. PART C (2 20 = 40 Marks) Answer any TWO questions 19. a) Using Trapezoidal rule, write a program to evaluate b f ( x) dx where f ( x) a 1 2 e 1 x 2 2 b) Write a program to find without using a separate function for factorials x3 x5 x7 Sin x = x ..... (10 +10) 3! 5! 7! with an error .0001 between the consecutive terms. 20. Explain the concept of function overloading and operator overloading with examples. (5 +15) 21. Explain the concept of simple inheritance, multiple inheritance and multilevel inheritance with examples. (4+8+8) 22. Write an interactive menu driven program that will create a data file containing the telephone numbers and names of the customers and implement the following tasks. i) Determine the telephone number of a given person. ii) Determine the name if a telephone number is known. iii) Update the telephone number whenever there is a change. (20) ***** 2