Object Oriented Programming 2079
Section A
Long Answer Questions
Attempt any TWO questions. [2 × 10 = 20]
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]
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]
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]
AI is thinking...
Section B
Short Answer Questions
Attempt any EIGHT questions. [8 × 5 = 40]
AI is thinking...
4. Can we use object-oriented concepts using structures instead of classes? Justify your opinion. [5]
AI is thinking...
5. In which cases are default arguments used? Describe with an example. [5]
AI is thinking...
6. What is the task of static data members and functions? Illustrate with an example. [5]
AI is thinking...
7. Differentiate between aggregation and inheritance. Why do we need a virtual base class? [2+3]
AI is thinking...
8. Define stream. How do you read text from a file? Describe. [1+4]
AI is thinking...
9. Explain the features of Object-Oriented Programming (OOP). [5]
AI is thinking...
10. Define namespace. List any two manipulators with their uses. [1+4]
AI is thinking...
11. Why do we need a friend class? How can we define a member function outside the class? [2+3]
AI is thinking...
12. Explain the use of a pure virtual function with an example. [5]
AI is thinking...