C++ Programming - C++ Classes And Objects Multiple Choice Questions and Answers

Following questions depends on the c++ classes and objects. Each questions has its unique answer.
1. Which of the following is false?
[A] Variable has scope & visibility
[B] Variables having scope may not be visible
[C] Variables having visibility may not have scope
[D] None of these
2. For a method to be an interface between the outside world and a class,it has to be declared ?
[A] private
[B] protected
[C] public
[D] external
3. In C++, a function contained within the class is called ?
[A] member function
[B] a class function
[C] a method
[D] none of above
4. classes are useful because they
[A] are removed from memory when not in use
[B] permit data to be hidden from other classes
[C] bring together all aspects of an entity in one place
[D] can closely model objects in the real world
5. The public files in a class library usually contain ?
[A] Constant definitions
[B] member function definitions
[C] class declarations
[D] variable definition
6. A class cannot be ?
[A] Virtual
[B] Generic
[C] Inline
[D] Friend
7. Objects of the same class share the values of ...... while they maintain separate values for ........ .
[A] Static variables, non static variables
[B] Non static variables, static variables
[C] Global variables, static variables
[D] Static variables, register variables
8. Which of the following keywords cannot appear inside a class definition ?
[A] friend
[B] static
[C] template
[D] virtual
9. Shallow copy is
[A] Member wise copying of objects
[B] A substitute for the operator
[C] Same kind like deep copy
[D] Used in constructor
10. Which member function of class cannot modify its objects attributes ?
[A] friend functions
[B] Private member functions
[C] Constant member functions
[D] Static member functions
Are these questions helpful for you?

Comments: (Your feedback is valuable to us)

Abdul Haseeb Shershahabadi 2 years ago Reply

Basic and good question it is helpful for concept clearation.

Izzatullo 5 years ago Reply

the quiz was awesome and of course useful