Bsc Csit Nepal

2076

Object Oriented Programming

Full Marks: 60
Pass Marks: 24
Time: 3 hours

Long Questions:

Attempt any two questions: (2 × 10=20)

  1. Write a program according to the specification given below:
    • Create a class Teacher with data members tid & subject and ember functions for reading and displaying data members.
    • Create another class Staff with data members sid & position, and member function for reading and displaying data members.
    • Derive a class Coordinator from Teacher and Staff and the class must have its own data member department and member functions for reading and displaying data members.
    • Create two object of Coordinator class and read and display their details.
  2. Explain the concept of operator overloading? List the operators that cannot be overloaded. Write programs to add two object of distance class with data members feet and inch by using by using member function and friend function.
  3. Explain types of polymorphism briefly. Write down roles of polymorphism. How can we achieve dynamic polymorphism briefly. Write down foles of polymorphism. How can we achieve dynamic polymorphism? Explain with example.

Short Questions

Attempt any eight questions: (8 × 5=40)

  1. How object oriented programming differs from object based programming language? Discuss benefits of OOP.
  2. What is the use of new and delete operators? Illustrate with example. What are advantages of new malloc.
  3. What is meant by return by reference? How can we return values by reference by using reference variable? Illustrate with examples.
  4. What is destructor? Write a program to show the destructor call such that it prints the message “memory is released”.
  5. What is this pointer? How can we use it for name conflict resolution?Illustrate with example.
  6. How can you define catch statement that can catch any type of exception? Illustrate the use of multiple catch statement with example.
  7. Which functions can be used for reading and writing object? Describe briefly. Write a program that read values of two objects of student class(assume data members are sid , sname, and level) and display the data in monitor.
  8. Write short notes on:
    • Cascading of IO operators
    • Pure Virtual Function