Object Oriented Programming 2072

Tribhuwan University
Institute of Science and Technology
2072
Bachelor Level / Third Semester / Science
Computer Science and Information Technology ( CSC-202 )
( Object Oriented Programming )
Full Marks: 60
Pass Marks: 24
Time: 3 hours
Candidates are required to give their answers in their own words as far as practicable.
The figures in the margin indicate full marks.

Section A

Attempt any two questions: (2x10=20)

1. Explain the object oriented programming with its advantages. What are the features of object oriented languages? Explain.

10 marks view

2. Write a program to overload the unary minus operator using friend function.

10 marks view

3. Explain the role of inheritance in object oriented programming. What is public, private and protected dentation? Explain.

10 marks view

Section B

Attempt any eight questions: (8x5 = 40)

4. Explain the syntax and rules of multiple inheritance in C++ with example.

5 marks view

When a class is derived from two or more base classes, such inheritance is called Multiple Inheritance. Multiple Inheritance in C++ allow us to combine the features of several existing classes into a single class.


Syntax:

class base_class1
{
    // body of the class
};
class base_class2
{
    //body of the class
};
class derived_classname : visibility_mode base_class1, visibility_mode base_class2
{
    //body of the class
};

Example:

#include <iostream>  

using namespace std;  

class A  

{  

    protected:

      int a;  

    public:  

    void get_a(int n)  

    {  

        a = n;  

    }  

};  

class B  

{  

    protected:

      int b;  

    public:  

    void get_b(int n)  

    {  

        b = n;  

    }  

};  

class C : public A, public B  

{  

   public:  

    void display()  

    {  

        cout << "The value of a is : " <<a<<endl;  

        cout << "The value of b is : " <<b<<endl;  

        cout <<"Addition of a and b is : "<<a+b;  

    }  

};  

int main()  

{  

   C obj;  

   obj.get_a(10);  

   obj.get_b(20);  

   obj.display();  

   return 0;  

}  

5. Explain do/while structure with example.

5 marks view

6. Explain the Inline function with example.

5 marks view

7. What is multiple inheritance? Explain with example.

5 marks view

8. Explain the static class members with example.

5 marks view

9. Differentiate between macro and function.

5 marks view

10. Explain the use of break and continue statements in switch case statements in C++.

5 marks view

11. Explain the different storage classes in C++.

5 marks view

12. Explain the multilevel inheritance. How is it different from multiple inheritance?

5 marks view

13. Explain the exceptional handling with example.

5 marks view