Bsc Csit Nepal

2071

Object Oriented Programming

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

Long Questions:

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

  1. Why do we need object oriented programming? How can we use inheritance to reuse already written and tested code in programs? Discuss with suitable example. (3+3+4)
  2. Discuss features of class and object. Design a class to represent a bank account with data members name, account-number, account-type, and balance and functions to assign initial values, to deposit an amount, to withdraw an amount after checking balance, and to display the name and balance. (4+6)
  3. What is operator overloading? What are the benefits of overloading? How is operator overloading different from function overloading. Write a program that shows an example of function overloading. (2+2+2+4)

Short Questions

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

  1. Discuss polymorphism with example.
  2. What is library function? How is it different from user defined function?
  3. What is looping? Differentiate while loop with do-while loop with example.
  4. Discuss the use of inline function with example.
  5. What is constructor? Differentiate it with destructor.
  6. Explain about accessing a member function outside a class with example.
  7. Write a program that decreases an integer value by 1 (one) by overloading-operator.
  8. Differentiate between abstract base classes and concrete classes.
  9. What is function template? Differentiate it with class template.
  10. Write a program to show exception handling.