Bsc Csit Nepal

2068

Object Oriented Programming

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

Long Questions:

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

  1. What are the main feature of the Object-Oriented Programming. Explain with suitable practical examples.
  2. Explain the role of constructor and destructor in Object-Oriented Programming. Discuss user defined parameterized constructor with suitable example.
  3. Define a Shape class (with necessary constructors and member functions) in Object Oriented Programming (abstract necessary attributes and their types). (Write a complete code in C++ programming language).
    • Derive Triangle and Rectangle classes from Shape class adding necessary attributes.
    • Use these classes in a main function and display the area of triangle and rectangle.

Short Questions

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

  1. Why dynamic object is needed? Explain with suitable example.
  2. What is function overloading? Explain with suitable example.
  3. Write a C++ program containing a possible exception. Use a try block to throw it and a catch block to handle it properly.
  4. Differentiate between base class and derived class with suitable examples.
  5. Differntiate between private, public and protected variable with suitable example.
  6. Differentiate container class from inheritance. Explain with suitable example.
  7. Explain the role of polymorphism in Object Oriented Programming.
  8. Explain about “this” pointer with suitable example.
  9. Write a program to find the square root of given integer using inline function.
  10. Write a program to convert inch into centimeter.