CS304 MID FALL 2010
We can get only one unique value which can be used by all the objects of that class by the use of,
A member function having the same name as that of a class and a ~ sign with it is called,
Using encapsulation we can achieve
Least interdependencies among modules
All of given options
Inheritance is a way to
make general classes into more specific classes.
pass arguments to objects of classes.
improve data hiding and encapsulation.
providing class growth through natural selection.
Static variable can be initialized more than once.
For classes with common behavior, you can save effort by placing the common behavior in a __________.
Which of the following are an advantage of OOP?
OOP makes it easy to re-use the code
It provides an ability to create one user defined data type by extending the other
It provides the facility of defining Abstract data types through which real world entities can be defined better
All of the given options
The >= operator can be overloaded.
A static member function cannot be declared.
Static variables act like a global variable in the context or scope of the class.
The compiler won’t object if you overload the * operator to perform division.
We can use "this" pointer in the constructor in the body and even in the initialization list of any class if we are careful,
A C++ class is similar to --------------------
None of the given
Which operator can not be overloaded?
The relation operator ( >= )
Assignment operator ( = )
Script operator (  )
Conditional operator (? : )
An overloaded operator always requires one less argument than its number of operands.
A generalization-specialization relation between classes are implemented using
In OOP a class is an example of _____
User Defined Type
None of the given
Identify which of the following overloaded operator function’s declaration is appropriate for the given call?
Rational_number_1 + 2.325
Where Rational_number_1 is an object of user defined class Rational_number.
Rational_number operator+( Rational_number & obj);
Rational_number operator+(double& obj);
Rational_number operator+(Rational_number &obj, double& num);
A class can be identified from a statement by -------------
The members of a class that can be accessed without creating the object of the class is called
What is difference between simple association and composition?
Friend functions minimize "Encapsulation", What is your opinion?
Write three important properties of constructors?
1. Tell the reason why we can not overload the following four operators in c++
. , .* , :: , ?:
2. Considering the complex number class can we subtract two complex numbers by overloading plus “+ “Operator. Justify your answer as well.
How we resolve the following problems in overloading of assignment operator in string class, (explain with the help of c++ code)
a. Self referencing
b. Assigning a string value to more than one strings in a single line like, stringobject1 = string object2 = stringobject3 = stringobject4
Consider the class given below explain the order in which variables x,y and z will be initialized after creating object of this class,
XYZ:: XYZ ():g(30),e(10),f(20)