Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
CS304
Final Term Examination – Spring 2006
Time Allowed: 150 Minutes
a
Question No. 1 Marks : 1
te r i
+ operator for thecomplexclass?
2. complex add
3.
4.
5.
+
operator +
operator
C a f e
V U
Question No. 2
2. the address
functio of an
3. a temporary object created within the
object
4. the object that called the
function
object that will be returned from the
function
5. the
function
Question No. 3 Marks : 3
Wr ite two classes Customer and Account. Declar e Account as a friend class of Customer.
a) Write parameterized constructors for both classes i. Customer and Account, to initialize their
e. members. ForCustomer class
data Pageinitialize
1 / 6cusbalance to zero.
Note: Solve these papers by yourself
VU Cafeteria is not responsible for any solved content
VU Cafeteria
}
Yclass = new YourClass[3];
t e r i a
Do you see any problem with the code
above?
1. The class name is invalid
2. The public members should be
3. The
C a f e
ided above the private members in the
provconstructor is declared privateclass
an array is being created in the function main,
the statement will result in an or therefore,
but
4. err
V U
The array creating syntax is incorrect
5. Return type of main () is not int
1. name
Th is class should have a parameterized and destructor, the getter/setter functions and
virtual member functionconstructor a
calledpay () that returns the salary of theEmployee.
b) Create a class named asSalaried that inherits from classEmployee. A Salaried object has the
foll owing attribute
1. salary
c) Similarly, develop a class named as Hourly that inherits from classEmployee. An Hourly object is
distinguished by the following attributes
1. hours
2. rate
Page 2 / 6
Note: Solve these papers by yourself
VU Cafeteria is not responsible for any solved content
VU Cafeteria
1: length
t e r i a
2: width
a f e
T he area and perimetershould be calculated for eachint, float and doubletype data member. Hence
data member of theclass
rectangle
C
should be of typeTemplate as well. the
1: area U
Your program should have following member functionsof a template <class T>.
V ();
T his member function will calculate thearea of the rectangle. The area of a rectangle can be calculated
by the following formula:
2: perimeter ();
T his member function will calculate theperimeter of the where the formula for perimeter of
rectangle is rectangle
Area() and perimeter()member functions should return the same type on which the data is
manipulating.For example
If the area is calculating for a rectangle of int type lengthand width, then this member functionshould
return an integer numberand vice versa.
Ta ke three instances of one of each type of data int, float, and doublefor the class rectangle
members’
in main ().
1. Student();
2. Student(int);
3. ~ Student();
4. int~ Student();
5. ~ Student(int);
Is there any difference between abstract and base class? If yes, then what is
it?
t e r i a
Q uestion No. 12
C a f e Marks : 10
V U
Q uestion No. 13
Q uestion No. 14
Marks : 1
Marks : 1
Q uestion No. 24
t e r i a Marks : 1
Qu estion No. 25
C a f e Marks : 3
V U
Q uestion No. 26 Marks : 1
Page 5 / 6
Note: Solve these papers by yourself
VU Cafeteria is not responsible for any solved content
VU Cafeteria
t e r i a
C a f e
V U
Page 6 / 6
Note: Solve these papers by yourself
VU Cafeteria is not responsible for any solved content