LOYOLA COLLEGE (AUTONOMOUS), CHENNAI-600 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
- 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; }
- Explain the switch structure.
- Write a program to get the output as
1 2 3 4 5
2 3 4 5
3 4 5
- 5
5
- Write a recursive program to get the factorial of a number.
- What is prototyping?
- What is encapsulation?
- Explain destructor.
- What is a pointer variable?
- What is the use of the dot operator and scope resolution operator while using
a class?
- Explain strcpy ( ), strcat ( )
PART – B (5 ´ 8 = 40 Marks)
Answer any FIVE questions.
- Explain constructors with examples.
- Explain structures with examples.
- Write a program to find the largest element in a matrix.
- Illustrate how runtime polymorphism is achieved with the help of virtual functions.
- 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 ½)
- Illustrate the use of default arguments.
- Illustrate with an example the use of friend functions.
- Explain with an example passing objects as arguments.
PART – C (2 ´ 20 = 40 Marks)
Answer any TWO questions
- a) Using Trapezoidal rule, write a program to evaluate
- Write a program to find without using a separate function for factorials
Sin x = (10 +10)
with an error .0001 between the consecutive terms.
- Explain the concept of function overloading and operator overloading
with examples. (5 +15)
- Explain the concept of simple inheritance, multiple inheritance and multilevel
inheritance with examples. (4+8+8)
- 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.
- Determine the telephone number of a given person.
- Determine the name if a telephone number is known.
- Update the telephone number whenever there is a change. (20)