POKHARA UNIVERSIT Y
Level: Bachelor Semester: Spring Year : 2024
Programme: BE Full Marks: 100
Course: Object Oriented Programming in C++ Pass Marks: 45
Time : 3 hrs.
Candidates are required to give their answers in their own words as far
as practicable.
The figures in the margin indicate full marks.
Attempt all the questions.
1. a) Why software development process is not linear? List out the 7
significance of forming abstraction while designing an
object-oriented system.
b) Write an advantage of friend function. Write a program to add private 8
data of two classes using friend function.
2. a) Why is class preferred over structure? Support your answer with 8
suitable OOP features and program.
b) Create a C++ program to define a class Height with data members 7
feet and inches. Implement a constructor to initialize feet and inches.
Create a method addHeight() that takes two heights and adds them
together and a display() function to display the result.
3. a) Why dynamic memory allocation is better than static memory 8
allocation? How dynamic memory allocation can be achieved in
C++? Explain with suitable example.
b) Write a complete program based on the provided figure. Note that 7
alpha, beta, and gamma are class names, and showa(), showb(), and
showg() are functions that display the data members of their
respective classes.
Page 1 of 2
4. a) Differential between subclass and subtype? How is ambiguity 8
resolved in multiple inheritances? Explain with suitable program.
b) Explain about is a rule and has a rule. Write a program for 7
composition in class.
5. a) Define two class ‘polar’ and ‘rectangle’ to represent points in polar 8
and rectangular coordinate. Use conversion routine in source object
to convert polar coordinate to rectangular coordinate.
b) What is a virtual function? When and how do we make a function 7
virtual? Explain with a suitable example.
6. a) What is exception? How is it handled in C++? Write a program to 8
handle exception with multiple catch blocks.
b) Explain CRC cards and sequence diagram with suitable examples. 7
7. Write short notes on: (Any two) 2×5
a) Function overloading
b) This pointer
c) Programming in small and programming in large
Page 2 of 2