Objects and Classes

1

Which of the following statements are correct for a static member function?

       1. It can access only other static members of its class.

       2. It can be called using the class name, instead of objects.

A. Only 1 is correct.
B. Only 2 is correct.
C. Both 1 and 2 are correct.
D. Both 1 and 2 are incorrect.

2

Which of the following is the only technical difference between structures and classes in C++?

A. Member function and data are by default protected in structures but private in classes.
B. Member function and data are by default private in structures but public in classes.
C. Member function and data are by default public in structures but private in classes.
D. Member function and data are by default public in structures but protected in classes.

3

Which of the following means "The use of an object of one class in definition of another class"?

A. Encapsulation
B. Inheritance
C. Composition
D. Abstraction

4

Which of the following can be overloaded?

A. Object
B. Functions
C. Operators
D. Both B and C

5

Which of the following statements is correct?

A. Data items in a class must be private.
B. Both data and functions can be either private or public.
C. Member functions of a class must be private.
D. Constructor of a class cannot be private.