Pokhara University
Bachelor of Engineering in Computer Engineering
Semester 2 · PU Spring 2023
Course Title: Object Oriented Programming in C++
Full Marks: 100Pass Marks: 45Time: 3hrs.
Candidates are required to give their answers in their own words as far as practicable.
- 1.15
- a) Explain non-linear behaviour of complexity. How is OOP different from POP? Justify with points.
OR
Define Responsibility Driven Design. Demonstrate the significance of CRC in OOP with an example.
- b) What shortcomings of structure are solved by classes? Explain different types of constructors available in C++ with their use.
- 2.15
- a) Does the friend function breach Data hiding? Justify. Write a program = to swap the values of variables of two classes using friend function.
- b) How is DMA better than SMA? Justify your answer. Explain how new = and delete operators are used in DMA.
- 3.7
- a) Define static member. Write a program to illustrate the use of static members and static member function.
- b) How inheritance increases the reusability of codes? Explain different g types of inheritance with suitable diagram and syntax.
- 4.7
- a) What is diamond problem in inheritance? Explain how this problem can be solved with suitable programming example.
- b) Define two ways of converting one user defined data type to another —_g user defined type. Write a program that convert kilogram into gram using user define to user define data conversion. (1kg=1000gm).
OR
WAP to find the sum of two 3x3 matrix by overloading binary operator +.
- 5.15
- a) What do you mean by virtual function? Write a program to show the use of virtual function to achieve runtime polymorphism. 1 Aarnl ES ee eee
- b) Why is generic programming beneficial? Explain template function and class template with syntax.
- 6.7
- a) Define Exception handling. Does C++ support multiple catch? Illustrate with suitable programming example.
- b) Write a program that stores object of student class (assume data g members are roll, name and university_ name) into a file and read values from the file and display the data in console.
- 7.
Write short notes on: (Any two) 2x5
- a) STL
- b) Use of this pointer
- c) OOAD Wa Sn 2
— The End —