Pokhara University
Level: Bachelor
|
Semester – Fall
|
Year : 2006
|
Programme: BE
|
Full Marks: 100
|
|
Course: Object
Oriented Programming in C++
|
Time : 3hrs.
|
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 in your own words how object
oriented programming permits the development of reusable software components.
Also, list the three most important features of an object oriented
programming language.
b) Explain and contrast the following:
·
Interface
and Implementation
·
Programming
in the small and Programming in the large
|
7
8
|
2.
|
a)
What is the difference between a message and
a procedure call? Explain in detail the message passing syntax in C++.
b)
Create
a new class named City that will have two member variables CityName
(char[20]), and DistFromKtm (float). Add member functions to set and retrieve
the CityName and DistFromKtm separately. Add new member function AddDistance
that takes two arguments of class City and returns the sum of DistFromKtm of
two arguments. In the main function, initialise three city objects. Set the
first and second city to be Pokhara and Dhangadi. Display the sum of
DistFromKtm of Pokhara and Dhangadi calling AddDistance function of third
City object.
|
7
8
|
3.
|
a)
What
is generic programming and explain how it is implemented in C++? What do you
mean by STL and container classes.
b)
Explain
Polymorphic Variables and Deferred Methods. When is the use of Deferred Methods
preferred?
|
7
8
|
4.
|
a)
A
company needs to keep record of its following employees:
i)
Manager ii) Supervisor
The
record requires name and salary of both employees. In addition, it also
requires section_name (i.e. name of section, example Accounts, Marketing,
etc.) for the Manager and group_id
(Group identification number, e.g. 205, 112, etc.) for the Supervisor. Design
classes for the above requirement. Each of the classes should have a function
called get() to get data from the user and a function called put() to display
the data on the screen. Write a main program to test your classes. What form
of inheritance will the classes hold in this case?
b)
Explain
briefly the theory of “Composition” and “Substitutability” in respect to
software reusability.
|
10
5
|
5.
|
a)
What
do you mean by dynamic initialisation of object? Why do we need to do this
and how is it achieved?
b)
Explain
different types of inheritance with the relative merits and demerits of each
type. Support your answer with examples.
|
7
8
|
6.
|
a)
Create
a class with two integer data members, a constructor that sets the values of
the members to the values passed to it as parameters and a function to
display the values of the members.
Overload ‘+’ operator such that when you do A = B + C; where A, B and C are objects of that class and data members of B should be added to data members of C leaving the result in object A. Write the main program to test this operation.
b) What do you mean by CRC card? When is it
useful? Draw CRC card for the information as given in question no. 4 (a)
above.
|
8
7
|
7.
|
Write short notes (Any Two):
a)
Computation as Simulation
b)
Stack versus Heap Storage Allocation
c)
Access Specifiers for Class Visibility
|
2×5
|
No comments:
Post a Comment