Object Oriented Programming 2072

Question Paper Details
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

Official Answer
AI Generated Answer

AI is thinking...

Attempt any two questions: (2x10=20)

Official Answer
AI Generated Answer

AI is thinking...

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

10 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

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

10 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

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

10 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

Section B

Official Answer
AI Generated Answer

AI is thinking...

Attempt any eight questions: (8x5 = 40)

Official Answer
AI Generated Answer

AI is thinking...

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

5 marks
Details
Official Answer

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;  

}  

AI Generated Answer

AI is thinking...

5. Explain do/while structure with example.

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

6. Explain the Inline function with example.

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

7. What is multiple inheritance? Explain with example.

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

8. Explain the static class members with example.

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

9. Differentiate between macro and function.

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

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

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

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

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

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

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

13. Explain the exceptional handling with example.

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...