Latest

10/recent/ticker-posts

OOP 22316 Solved Lab Manual - Object Oriented Programming using C++ Solved Lab Manual

VIEW PDF

Practical No. 1: Develop minimum 2 programs using constants, variable, arithmetic expression, operators, exhibiting data type conversion
Covered Points/Questions:
XII. Practical Related Questions:

  1. Constant variable can be created in C++ by using ______
  2. State the output of the following code:
    #include <iostream.h>
    void main()
    {
    typedef int num;
    num a= 10, b = 15;
    num c = a+b + a-b;
    cout << c;
    }
  3. Reading following statements which of the statement is true? const int a=100;
    • Declare a variable a with 100 as its initial value.
    • Declare a construction a with 100 as its initial value
    • Declare a constant a whose value will be 100
    • Constructs an integer type variable with a as identifier and 100 as value
XIII. Exercise:
  1. Complete the given table
    1. #include <iostream.h>
      #define PI 3.14159
      int main ()
      {
      float r = 2;
      float circle;
      circle = 2 * PI * r;
      cout << circle;
      return 0;
      }
    2. #include <iostream.h>
      #include <conio.h>
      void main()
      {
      clrscr();
      float res;
      float f1 = 15.5, f2 = 2;
      res = (int) f1/ (int)f2;
      cout <<res<< end1;
      res = f1/f2;
      cout<<res;
      getch ();
      }

Practical No. 4: Program to Implement One Dimension Arrya
Covered Points/Questions:
XII. Practical Related Questions:

  1. State output of the following code
  2. Which of the following correctly declares an array?
    a) int array[10];
    b) int array;
    c) array{10};
    d) array array[10];
XIII. Exercise:
  1. Write a C++ program to find median of two sorted arrays of same size.
  2. Complete the given table:

Practical No. 6: Program to Implement Classes and Objects
Covered Points/Questions:
XII. Practical Related Questions:

  1. What is the difference between struct and class in C++?
  2. State the output of the following code:
    #include<iostream.h>
    class Empty {};
    void main ();
    {
    cout << sizeof (Empty);
    }
  3. State True or False: Data items in C++ class are by default public
XIII. Exercise:
  1. Write a C++ program to declare a class "Book" having data members book_name, author and price. Accept and display data for book having maximum price.
  2. Write a C++ program to declare a class "staff" having data members name, basic salary, DA, HRA and calculate gross salary. Accept and display data for one staff
    • Where DA=74.5% of basic
      i. HRA=30% of basic.
      ii. Gross_salary=basic+HRA+DA
  3. Complete the given table:

Practical No. 7: Program to Implement Array and Objects
Covered Points/Questions:
XII. Practical Related Questions:

  1. State the output of the following program.
XIII. Exercise:
  1. Write a C++ program to define a class "Employee" having data members emp_id, emp_name, and emp_salary. Accept and display data for employees having salary greater than 25,000/-
  2. Write a C++ program to define a class "City" having data members name, population. Accept and display data for 10 cities.
  3. Complete the given table.

Practical No. 8: program to Implement Friend Function
Covered Points/Questions:
Covered Points/Questions:
XII. Practical Related Questions:

  1. Can member functions of one class be friend functions of another class?
    • a) Yes   b) No
  2. A function can be declared as friend maximum only in two classes.
    • a) Yes   b) No
  3. Which of the following rules will not which not affect the friend function.
    • a) private and protected members of a class cannot be accessed from outside.
    • b) private and protected members can be accessed anywhere
    • c) protected members can be accessed anywhere
    • d) None of the mentioned
  4. Where does keyword 'friend' should be placed?
    • a) function declaration
    • b) function definition
    • c) main function
    • d) none of the mentioned
XIII. Exercise:
  1. Write a C++ program to swap the values of two variables using friend function.
  2. write a C++ program to define a class "Distance" having data members as meters. Display the addition of two Distance objects using friend function.
  3. Complete the given table

Practical No. 10: Program to Implement Constructors and Destructors.
Covered Points/Questions:
XII. Practical Related Questions:

  1. What happens when a class with parameterized constructor and having no default constructor is used in a program and we create an object that needs a zero-argument constructor?
    • a) Compile-time error.
    • b) Preprocessing error.
    • c) Runtime error.
    • d) Runtime exception.
  2. For automatic objects, constructors and destructors are called each time the objects
    • a) enter and leave scope
    • b) inherit parent class
    • c) are constructed
    • d) are destroyed
  3. Which of the following statement is correct about the program given below
XIII. Exercise:
  1. Write a C++ program to define a class "Number" having data members x and y and perform mathematical operations like addition, subtraction, multiplication, division on two numbers using Constructor and destructor function
  2. Write a C++ program to define a class "Product" having data members Prod_id, Prod_name, Prod_price,. Accept and display data for 3 products using constructor overloading.


Practical No. 11: Program to Implement Single Inheritance
Covered Points/Questions:
XII. Practical Related Questions:

  1. A derived class with only one base class is called ..... inheritance.
    • a) single
    • b) multiple
    • c) multilevel
    • d) hierarchical
  2. When a class is privately inherited by the derived class, then ______.
    • a. protected members of the base class become private members of derived class
    • b. public members of the base class become private members of derived class
    • c. both a and b
    • d. only b
  3. The derivation of Child class from Base class is indicated by ______ symbol.
    • a. ::
    • b. :
    • c. ;
    • d. |
XIII. Exercise:
  1. Write a C++ program to define a class "Student" having data members roll_no, name. Derive class "Marks" from "Student" having data members m1, m2, m3, total and percentage. Accept and display data for one student.
  2. Write a C++ program to define a class "Employee" having data members emp_no, emp_name and emp_designation. Derive a class "Salary" from "Employee" having data members basic, hra, da, gross_sal. Accept and display data for one employee.
  3. Complete the given table

Practical No. 12: Program to Implement Multi Level Inheritance
Covered Points/Questions:
XII. Practical Related Questions:

  1. Answer of the question no.1 is given in PDF
  2. A class can be derived from another derived class which is known as..........Inheritance.
    • a) single
    • b) multiple
    • c) multilevel
    • d) hierarchical
  3. In........inheritance, the constructors are executed in the order of inheritance.
    • a) multipath
    • b) multiple
    • c) multilevel
    • d) hierarchical
  4. Base class and derived class relationship comes under
    • a) Inheritance
    • b) Polymorphism
    • c) encapsulation
    • d) None

Practical No. 13: Program to Implement Concept Multiple Inheritance
Covered Points/Questions:
XII. Practical Related Questions:

  1. What is the difference between multiple and multilevel inheritance in C++ ?
  2. State output of the following code:
XIII. Exercise:
  1. Write a C++ program to calculate the area and perimeter of rectangles using concept of inheritance.
  2. Write a C++ program for representation of class hierarchy as below. Assume suitable data and function members.
  3. Complete the given table

Practical No. 14: Program to Implement Pointer to Object
Covered Points/Questions:
XII. Practical Related Questions:

  1. State output of the following code:
  2. Which is the pointer which denotes the object calling the member function?
    • a) Variable pointer
    • b) This pointer
    • c) Null pointer
    • d) Zero pointer
  3. A pointer can be initialized with _______.
    • a) null
    • b) zero
    • c) Adress of an object of same type
    • d) All of them
XIII. Exercise:
  1. Write a C++ program to declare a class "Book" containing data members book_name, author_name and price. Accept this information for one object of the class using pointer to that object.
  2. Write a C++ program to declare class "Box" having data members height, width, and breadth. Accept this information for one object of the class using pointer to that object. Display the area and volume of that object.

Practical No. 15: Program to Implement Pointer Derived Class
Covered Points/Questions:
XII. Practical Related Questions:

  1. A pointer to the base class can hod adress of
    • a) only base class object
    • b) only derived class object
    • c) base class object as well as derived class object
    • d) None of the above
  2. Which variable stores the memory address of anothe variable?
    • a) Reference
    • b) Pointer
    • c) Array
    • d) None of the above
XIII. Exercise:
  1. Write a C++ program declare class "polygon" having data members width and height. Derive classes "rectangle" and "triangle" from "polygon" having area() as a member function. Calculate area of triangle and rectangle using pointer to derived class object.
  2. Complete the given table:

Practical No. 18: Program to Implement Functional Overloading
Covered Points/Questions:
XII. Practical Related Questions:

  1. Does constructor overloading is implementation of function overloading?
  2. State output of the following code:
  3. Which of the following Object Oriented Programming is supporetd by function overlooking and default arguments features of C++?
    • a) Inheritance
    • b) Polymorphism
    • c) Encapsulation
    • d) None of these
  4. Overloaded functions are
    • a) Very long functions that can hardly run
    • b) One function containing another one or more functions inside it.
    • c) Two or more functions with the same name but different number parameters or type.
    • d) None of these
XIII. Exercise:
  1. Write a C++ program to interchange the values of two int, float and char using function overloading.
  2. Write a C++ program to find the area of various geometrical shapes by function overloading.

OOP 22316 Solved Lab Manual PDF

OOP 22316 Solved Lab Manual - Object Oriented Programming using C++ Solved Lab Manual

Post a Comment

0 Comments