0% found this document useful (0 votes)
121 views5 pages

CS304 Object Oriented Programming Solved MID Term Paper 02

Uploaded by

Mudassar Qureshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
121 views5 pages

CS304 Object Oriented Programming Solved MID Term Paper 02

Uploaded by

Mudassar Qureshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

FOR MORE PAPERS | LOGON TO WWW.VUSSS.

COM
MID TERM

CS304 - Object Oriented Programming

Question No: 1 ( 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: 2 ( 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: 3 ( 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: 4 ( Marks: 1 ) - Please choose one


Identify which of the following overloaded operator function’s declaration is
appropriate for the given call?

Ratipnal_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); (Page 145)
► Rational_number operator+(Rational_number &obj, double& num);
► operator+(double& obj);

FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM


Page 1 of 5
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
MID TERM

Question No: 5 ( Marks: 1 ) - Please choose one


__________ provide the facility to access the data member.
► accesser function (Page 68)
► private function
► inline function
► None of the given

Question No: 6 ( Marks: 1 ) - Please choose one


Constant objects cannot change their state,
► True (Page 105)
► False

Question No: 7 ( Marks: 1 ) - Please choose one


The ________ relationship indicates that an object contains other objects.
► None of given (Page 53)
► ‘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 (Page 25)

Question No: 9 ( Marks: 1 ) - Please choose


one _______ is a relationship
► Inheritance (Page 25)
► Polymarphism
► abstraction
► encapsulation

Question No: 10 ( Marks: 1 ) - Please choose one


__________ satisfy the condition of polymorphism
► Carbon
► Diamond
► Coal
► all of the given (Page 56)

FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM


Page 2 of 5
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
MID TERM

Question No: 11 ( Marks: 1 ) - Please choose one


A generalization-specialization relation between classes are implemented
using
► data hiding
► friend classes
► encapsulation
► inheritance (Page 49)

Question No: 12 ( Marks: 1 ) - Please choose one


The >= operator can be overloaded.
► True (Page 140)
► False

Question No: 13 ( Marks: 1 ) - Please choose one


In order to free the memory occupied by the object, we use -------------
► Constructor
► Destructor (Page 92)
► 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 (Lecture No.5)
► 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 (Page 26)
► Encapsulation
► Polymarphism
► Abstraction

FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM


Page 3 of 5
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
MID TERM

Question No: 17 ( Marks: 2 )


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

Question No: 18 ( Marks: 2 )


Consider the following code segment:

class User {
char * name;
const int id;
public:
User(){
Id=123; // It gives an error
}
};

So how we can assign a value to constant id?

Question No: 19 ( Marks: 3 )


Give c++ code to overload assignment operator for string class.

Question No: 20 ( Marks: 3 )


Consider the code given below explain what kind of association exists
between class A and class B. Justify your answer as well.

class A{

private:
int a,b,c;

public:
….
};

class B{

private:
int d,e,f;
A obj1;
public:
….
};

FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM


Page 4 of 5
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
MID TERM

Question No: 21 ( Marks: 5 )


How we can use the concept of overloading to convert a type according to
our own requirements? Give one example.

Question No: 22 ( Marks: 5 )


Consider the following scenario,

In a University a Course consists of 45 Lectures, 6 Assignments, 1 Quiz and 1


GMDB, similarly each Lecture has corresponding 1 general MDB; you have to
model this scenario as an Object Model clearly showing type of associations
(simple association, composition or aggregation) between these
Objects.

FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM


Page 5 of 5

You might also like