OOP(321303)                    SET C
Program Name                 : Computer Engineering Program Group Program
 Code                         : CW/IF
 Semester                     : Third
 Course Title                 : Object Oriented Programming using C++
 Max. Marks                   : 70      Time: 3 Hrs.
 Instructions:
 (1) All questions are compulsory.
 (2) Illustrate your answers with sketches wherever necessary.
 (3) Figures to the right indicate full marks.
 (4) Assume suitable data if necessary.
 (5) Preferably, write the answers in sequential order
1. Attempt any FIVE of the following:                                 10
    a)   Explain user defined datatype with example.
    b) Define file with it’s operations . Explain file modes used to perform file operations.
    c) State different types of visibility mode in inheritance.
    d) Give output for following code:
         class student
         {
         int roll no;
         char name [14];
         } s[6];
         void main( )
         {
         cout<<sizeof(s);
         }
    f) Differentiate between OOP and POP.
    g) Give meaning of following statements:
         int * ptr, a = 5;
         ptr = &a ;
         cout<< * ptr ;
         cout<<( *ptr) + 1;
    h) Explain reference and dereference operators w.r.t. pointer.
2. Attempt any THREE of the following: 12
a) Write a C++ program to declare a class ‘circle’ with data members as radius and area. Declare a function getdata to accept
    radius and putdata to calculate and display area of circle.
b) Describe memory allocation for objects.
c) Develop a c++ program for multilevel inheritance.
d) Develop a c++ program for accept data from user to calculate percentage for 5 subject and display grade according to
    percentage.
3. Attempt any THREE of the following: 12
     a)   Write a C++ program to find the area of rectangle using class rectangle which has following details i) Accept
          length and breadth from the user. ii) iii) Calculate the area Display the result.
     b) Describe how memory is allocated to objects of class with suitable diagram
     c) Write a program to declare a class measure having data members add1, add2 and add3. Initialize the data
          members using constructor and store their addition in third data member using function and display the
          addition.
     d) Explain with suitable example Friend Function
     4. Attempt any THREE of the following: 12
      a) Develop a c++ program to implement inheritance shown in following fig.
      d) Develop a c++ program to create structure student with data member Name, Roll No., percentage accept and display data
           for 5 student using structure.
 e) Write a program to display string in reverse order by using pointer. .
      c) Explain the friend function with proper example.
5. Attempt any TWO of the following: 12
 a) Write a C++ program to declare a class student with members as roll no, name and department. Declare a parameterised
 constructor with default value for department as ‘CO’ to initialize members of object. Initialize and display data for two students.
 b) Write a C++ program to implement following inheritance: Refer Fig. No. 1.
 Accept and display total of one object of result.
 c) Write a program to declare a class ‘student’ having data members as ‘stud_name’ and ‘roll_no’. Accept and displaythis data for
 5 students.
 6. Attempt any TWO of the following: 12
 a) (i) Describe structure of C++ program with diagram.
      (ii) Write a C++ program to add two 3 × 3 matrices and display addition.
 b) Write a program to implement the following hierarchy using suitable member functions. Refer Figure No. 2.
    c) Write a program to implement inheritance as shown in figure No. 2. Assume suitable member function
d) Differentiate between constructor and destructor in C++. (Any four points)