Sei sulla pagina 1di 2

POKHARA UNIVERSITY

Level: Bachelor Semester – Spring Year : 2009


Programme: BE Full Marks : 100
Pass Mark : 45
Course: Object Oriented Programming in C++ 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. Explain the term object oriented programming as a new paradigm. 8


What features of oop make it distinguished from procedural
programming in paradigms?
b. What design starts with analyzing behaviour of the components?
7
Illustrate CRC card for class student and course in university
information system.
2. a. What is the significance of using classes and objects? Explain 7
about the various access specifiers used in C++?
b. Describe the mechanism of creation and initialization of objects in 8
C++. Can constructors be over loaded? Explain with relevant
example.
3. a. Create a class called country containing its name (char) and air 8
distance from Nepal (float). Add member functions to set and
retrive the CountryName and DistFromNepal separately. Add new
member function AddDistance that takes two arguments of class
Country and returns the sum of DistFromNepal of two arguments.
Initialise any three country objects in the main function. Set the
first and second country to be Japan and Italy. Display the sum of
DistFromNepal of Japan and Italy calling AddDistance function of
third country object.
b. Inheritance enables software reusability, how? Explain different
forms of inheritance. 7

4. a. Differentiate is-a and has-a relationship with example. 7


b. Create two classes Publication and Sales. The publication class 8
holds the title and price and the sales class holds the total monthly
sales. Derive a class called Book from both publication and sales.
The book class stores author's name and page count. Each of these

1
three classes should have a function to get its data from the user
and a function to display the data on the screen. Write complete
code to test the functionality of all the classes.
5. a. What do you mean by compile time polymorphism and run-time 8
polymorphism? Give an example for function overloading.
b. Write a program to overload * and + operators such that two 7
objects of a complex class (i. e. a class to represent complex
numbers) can be multiplied and added.
6. a. What is virtual function? Explain about Deferred method with a 8
simple example.
b. Create a template class to find the scalar product of vector of 7
integers and vector of floating point numbers.
7. Write short notes on (Any Two): 2×5
a. Message passing
b. CRC cards
c. STL

Potrebbero piacerti anche