VTU Previous Exam Papers BE CS 3rd Semester Object Oriented Programming with C++ Dec.07/Jan.08

VTU Previous Exam Papers BE CS 3rd Semester

Object Oriented Programming with C++ Dec.07/Jan.08

 

1 a.  Distinguish between procedural oriented and object oriented programming.

b. With the help of examples explain:

i) # if def and # else

ii) new

iii) enumeration type

c.   Explain how C++ supports encapsulation and polymorphism.

 

2  a. With example explain the different types of parameter passing mechanisms.

b. When will you make a function inline? Why? How is it defined in C++?

c.   Write a function power ( ) to raise a number 6m’ to a power ‘n’. The function takes a double value for ‘m’ and integer value for ‘n\ Use a default value of 2 for 4n’ when argument is omitted. Write a main that gets the values of ‘m’ and ;n’ from the user to test the function.   (08 Marks)

 

3 a.  What is function overloading? Illustrate with an example.

b.  What is a generic function? Write a generic function to swap two data elements and demonstrate for float and character type data.

c.   Distinguish between local and global objects.

 

4 a. Define a class by name complex. Write a member function to add two complex number and a friend function to subtract two complex number.

b. Define a class called student with register number, name, subject, test 1, test 2 and test 3 marks. Create an array of objects and display the students details with average test marks.

c. What is a constructor? How to invoke a constructor? With an example distinguish between parameterized constructor and a copy constructor.

 

5 a. List the operators that cannot be overloaded. Define a complete class by name distance with feet and inches as data members and overload + = operator to add two objects.

b. What is inheritance ?

 

6 a. Explain the different forms of inheritance with block diagram. How does C++ support single inheritance?

b.  In what order are the class constructors invoked when a derived class object is created? Explain with an example.

 

7 a. Illustrate the use of writing virtual functions with an example program.

b.  Define a class string that could work as a user-defined string type. Overload the operator » and «.

 

8 Write short notes on:

a.   This pointer

b.  Protected and private data members

c.   Static data members

d.  Nested classes.

Leave a Comment