CS304 VU Midterm Current Papers Fall 2011 of Virtual University of Paksitan (www.vusolutions.com)

No Comments
CS304 VU Midterm Current Papers Fall 2011 of Virtual University of Paksitan (www.vusolutions.com)

Question No: 21 ( Marks: 2 )

Write down C++ code for unary operator overloading.
Question No: 22 ( Marks: 2 )
Friend functions increase 'Programming bugs'. What is your opinion?
Question No: 23 ( Marks: 3 )
Explain overloading?
Question No: 24 ( Marks: 3 )

Give c++ code to overload unary '-- ' operator for complex numbers class.

Question No: 25 ( Marks: 5 )

Write down the out put of the following code:

class Student{ …
public:
static int noOfStudents; Student();
~Student();
};
int Student::noOfStudents = 0; Student::Student(){
noOfStudents++;
}
::~Student(){
noOfStudents--; }
int Student::noOfStudents = 0;
int main(){
cout <
cout <
Student studentB;
cout <
}

Question No: 26 ( Marks: 5 )

What are Accessor Functions, Explain with an example.
Question No: 1 ( Marks: 1 ) - Please choose one
Suppose that the Test class does not have an overloaded assignment operator. What happens when an assignment a=b; is given 

for two Test objects a and b?
► The automatic assignment operator is used
► The copy constructor is used
► Compiler error
► Run-time error

Question No: 2 ( Marks: 1 ) - Please choose one
a'A static member function can be called, even when a class is not __________.
► Declared
► Define
► Instantiated
► Called

Question No: 3 ( Marks: 1 ) - Please choose one
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);
► operator+(double& obj);

Question No: 4 ( Marks: 1 ) - Please choose one
What problem(s) may occur when we copy objects without using deep copy constructor?
► Dangling pointer
► Memory Leakage
► All of the given
► System crash

Question No: 5 ( Marks: 1 ) - Please choose one
__________ provide the facility to access the data member.
► accesser function
► private function
► inline function
► None of the given

Question No: 6 ( Marks: 1 ) - Please choose one
Constant objects cannot change their state,
► True
► False

Question No: 7 ( Marks: 1 ) - Please choose one
The ________ relationship indicates that an object contains other objects.
► None of given
► 'has-a'
► 'is-a'
► 'be-

Question No: 8 ( Marks: 1 ) - Please choose one
Which one of the following features of OOP is used to derive a class from another?
► Encapsulation
► Polymorphism
► Data hiding
► Inheritance

Question No: 9 ( Marks: 1 ) - Please choose one
_______ is a relationship
► Inheritance
► Polymarphism
► abstraction
► encapsulation

Question No: 10 ( Marks: 1 ) - Please choose one
__________ satisfy the condition of polymorphism
► Carbon
► Diamond
► Coal
► all of the given

Question No: 11 ( Marks: 1 ) - Please choose one
A generalization-specialization relation between classes are implemented using
► data hiding
► friend classes
► encapsulation
► inheritance

Question No: 12 ( Marks: 1 ) - Please choose one
The >= operator can be overloaded.
► True
► False

Question No: 13 ( Marks: 1 ) - Please choose one
In order to free the memory occupied by the object, we use -------------
► Constructor
► Destructor
► Shallow Copy
► Deep Copy

Question No: 14 ( Marks: 1 ) - Please choose one
Which of the following is not an example of multiple inheritances?----------
► Mermaid
► Woman 
► None of the given
► Amphibious Vehicle

Question No: 15 ( Marks: 1 ) - Please choose one
Static variable can be initialized more than once.
► True
► False

Question No: 16 ( Marks: 1 ) - Please choose one
A generic class showing all the common attributes and a behavior of other classes represents a very important feature in oop 

called --------
► Inheritance
► Encapsulation
► Polymarphism
► Abstraction
Next PostNewer Post Previous PostOlder Post Home

0 comments

Post a Comment