Bsc Csit Nepal

2074

Object Oriented Programming

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

Long Questions:

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

  1. Write down the features of  object oriented programming language and explain.

  2. Differentiate between single inheritance and multiple inheritance? Imagine a college hires some lectures. Some lectures are paid in period basic, while others are paid in month basic. Create a class called lecture that stores ID and name of lectures. From this class derive two classes: part time, which adds payperhr(type float): and full time, which adds paypermonth(type float). Each of these three classes should have a readdata() function to get its data from user at the key board and printdata() function to display the data.

    Write a main() program to test the Full time and Part time classes by creating instance of them asking the user to fill their data with readdata () and display the data with printdata().

  3. Why data conversion is needed? Write a program to convert kilogram into gram using user define to user define data conversion.(1 kg = 1000 gm).

Short Questions

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

  1. What is constructor ? Write a program to demonstrate constructor overloading.
  2. What is function overloading ? Explain with example.  6.What is function? Write a program to find greatest number among any three numbers using function.
  3. What is the role of protected access specifies in inheritance ? Explain with example.
  4. Differentiate between virtual function and pure virtual function.
  5. What is abstract base class? Give an example.
  6. Explain the role of operator overloading with example.
  7. What is friend function? Write a program to multiply any two private numbers of two different classes using friend function.
  8. Define try, throw and catch statement in C++ with example.
  9. Differentiate between class template and function template.