Classes and Objects
1.

What purpose do classes serve ?

A.  

data encapsulation

B.  

providing a convenient way of modeling real-world objects

C.  

simplifying code reuse

D.  

all of the above

2.

Which is not a protection level provided by classes in C++ ?

A.  

protected

B.  

hidden

C.  

private

D.  

public

3.

What value must a destructor return ?

A.  

A pointer to the class.

B.  

An object of the class.

C.  

A status code determining whether the class was destructed correctly

D.  

Destructors do not return a value.

4.

. Constructor is executed when _____. ?

A.  

An object goes out of scope

B.  

A class is declared

C.  

An object is created

D.  

An object is used

5.

How many ways of reusing are there in class hierarchy ?

A.  

1

B.  

3

C.  

4

D.  

2

6.

Where does the object is created ?

A.  

Class

B.  

Constructor

C.  

Destructors

D.  

Attributes

7.

Which of the following is a valid class declaration ?

A.  

Class A { int x; };

B.  

Class B { }

C.  

Public class A { }

D.  

Object A { int x; };

8.

Which of the following keywords is used to control access to a class member ?

A.  

Default

B.  

Break

C.  

Protected

D.  

Asm

9.

Which of the following statements is incorrect ?

A.  

Destructor of base class should always be static

B.  

Destructor of base class should always be virtual.

C.  

Destructor of base class should not be virtual.

D.  

Destructor of base class should always be private.

10.

Which operator can not be overloaded ?

A.  

+

B.  

::

C.  

-

D.  

*