Mid Term
1. Which part of an object exhibits its state?
A.  

Data

B.  

Operations

C.  

Any public part

D.  

Any private part

2.

Inheritance is a way to

A.  organize data. B.  pass arguments to objects of classes. C.  

add features to existing classes without rewriting them.

D.  

improve data-hiding and encapsulation.

3.

Suppose you have batch een given the following design, "A person has a name, age, address and sex. You are designing a class to represent a type of person called a patient. This kind of person may be given a diagnosis, have a spouse and may be alive". 

Given that the person class has already been created, what of the following would be appropriate to include when you design the patient class?

A.  

registration date and diagnosis 

B.  

age and sex

C.  

sex and diagnosis

D.  

diagnosis and age

4. What problem(s) may occur when we copy objects without using deep copy constructor?
A.  

Dangling pointer

B.  

Memory Leakage

C.  

All of the given 

D.  

System crash

5. this pointers are not accessible for static member functions.
A.  

True 

B.  False
6. A static member function cannot be declared.
A.  

Static

B.  

Implicit

C.  

Explicit

D.  

Virtual

7. _______ remain in memory even when all objects of a class have been destroyed.
A.  

Static variables

B.  

Instance variable

C.  

Primitive variables

D.  

None of given

8. Friend functions are _____________ functions of a class.
A.  

None of given

B.  

object member

C.  

non-member

D.  data member=
9. ___________, which means if A declares B as its friend it does NOT mean that A can access private data of B. It only means that B can access all data of A.
A.  Friendship is one way only B.  

Friendship is two way only

C.  

NO Friendship between classes

D.  

Any kind of friendship

10.

The statement obj A=objB; will cause a compiler error if the objects are of different classes.

A.  True B.  

False