Object Oriented Programming 2079

Question Paper Details
Tribhuwan University
Institute of Science and Technology
2079
Bachelor Level / Second Semester / Science
Information Technology ( Na )
( Object Oriented Programming )
Full Marks: 60
Pass Marks: 24
Time: 3 Hours hours

Section A

Long Answer Questions
Attempt any TWO questions. [2 × 10 = 20]

Official Answer
AI Generated Answer

AI is thinking...

1. What do we need templates for? Why does a program terminate after the occurrence of an exception? Describe the types of constructors. [2+2+6]

10 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

2. Differentiate between abstract class and concrete class. Write a program to create a class named 'Quadratic' that represents a function of the form f(x) = ax² + bx + c, where x is a real variable and a, b, c are real constants. The class must satisfy the following requirements:
a. A constructor should be provided that takes the values of a, b, and c as arguments. All three of these arguments should default to zero.
b. A function that takes a single argument x and returns the value of f(x).
c. All data members should be private. [2+8]

10 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

3. Explain the chain of constructors and destructors between subclasses and superclasses during inheritance with an example. Create a class named 'Point' with data members x and y. Overload the + operator to add the values of two objects of this class. [5+5]

10 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

Section B

Short Answer Questions
Attempt any EIGHT questions. [8 × 5 = 40]

Official Answer
AI Generated Answer

AI is thinking...

4. Can we use object-oriented concepts using structures instead of classes? Justify your opinion. [5]

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

5. In which cases are default arguments used? Describe with an example. [5]

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

6. What is the task of static data members and functions? Illustrate with an example. [5]

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

7. Differentiate between aggregation and inheritance. Why do we need a virtual base class? [2+3]

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

8. Define stream. How do you read text from a file? Describe. [1+4]

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

9. Explain the features of Object-Oriented Programming (OOP). [5]

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

10. Define namespace. List any two manipulators with their uses. [1+4]

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

11. Why do we need a friend class? How can we define a member function outside the class? [2+3]

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

12. Explain the use of a pure virtual function with an example. [5]

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...