Cochin University Exam Papers BE CS 3rd Semester
Object Oriented Programming Using C++ Nov 2009
IT/CS 304 Object Oriented Programming Using C++
(Answer all questions)
1. a. What is meant by abstraction? Explain with a suitable example.
b. Explain the advantages of pointers over references with examples.
c. What are constructors? Explain why we need constructors in C++.
d. Why do we need virtual functions?
e. Differentiate between overloaded functions and function templates.
f. Explain how ambiguity is resolved in the case of multiple inheritances.
g. What is an exception? Give an example to handle an exception.
h. Explain functions of “stream” class.
2. a. Explain features of object oriented programming.
b. Explain “Data Encapsulation” using a suitable example.
C. Write a C++program to evaluate the series V]
3 a. Explain the use of access specifies within a class.
b. Explain different types of control structures used in C++.
c. Write a C++program to generate Pascal’s triangle.
4 a. Explain die use of static member variables using an example.
b. Write a normal function which adds objects of a ‘Complex number’ class. Declare this normal function as a friend of the complex class.
5 a. What is the use of a copy constructor? Explain with a suitable example.
b. Implement a class with an overloaded’ +’ operator. Explain the following statements.
St2 = Stl+5;
St2 = 5+Stl
Where Stl and St2 are objects of the defined class.
6 a. Write a C++ program segment to show dynamic creation of 2D array.
b. Explain the use of virtual base c|ass with a suitable example.
7 a. List and explain two advantages and disadvantages of inheritance.
b. Write a C++program that contains a class derived from a base class. The base class should contain a virtual function x( ) and it should be over ridden. Try to call x( ) from the constructor of the base class and display the result.
8 a. How is polymorphism achieved at run time? Explain with an example program.
b. Write a program that illustrates the application of multiple catch statements during an exception handling.
9 a. A text file containing name of the students, and their marks for three subjects is given. Write a program to read the given file and display name and total marks of each students line by line.
Explain the following functions. Specify the arguments and return values of each of the functions:
(i) Stmcmp (ii) Strcpy (iii) Str coll ()