CS304 VU Midterm Papers Spring May 2012

Q1- Which type of copy is used by the default assignment operator “=” when applied to objects. Also
describe the reason.

Q2- Select the correct option from the following (justify it as well)
1. Static member functions of a class have access to only static data members of that class
2. Static member functions of a class have access to all member variables of that class.

Q3- Give the c++ code to overload post and pre decrement operators for Complex number class.

Q4- Consider the class given below explain the order in which variables x,y and z will be

initialized after creating object of this class,

class ABC{
int x;
int y;
int z;
public:
ABC();
};

ABC::ABC():z(10),x(20),y(30)
{

}

Q5-Consider the Object Model Diagram given below, and give the answers of the questions

given at the end,

Cash

Customer

Accounts

Saving

Checking

You are required to illustrate above diagram briefly in narrative / textual form.
Also identity at least thee abstract classes from the above diagram.

Q6-How we resolve the following problems in overloading of assignment operator in string
class, (explain with the help of c++ code)

a. Self referencing
Assigning a string value to more than one strings in a single line like, stringobject1 = string
object2 = stringobject3 = stringobject4

DOWNLOAD SOLUTION HERE
loading...