Top 150+ Solved Object Oriented Programming with C++ (OOP in C++) MCQ Questions Answer
Q. Which of the following is the only technical difference between structures and classes inC++?
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.
Q. 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.
Q. Which of the following means "The use of an object of one class in definition of anotherclass"?
a. Encapsulation
b. Inheritance
c. Composition
d. Abstraction
Q. Which of the following statements is correct when a class is inherited publicly?
a. Public members of the base class become protected members of derived class.
b. Public members of the base class become private members of derived class.
c. Private members of the base class become protected members of derived class.
d. Public members of the base class become public members of derived class
Q. Which of the following statements is correct about the constructors and destructors?
a. Destructors can take arguments but constructors cannot.
b. Constructors can take arguments but destructors cannot.
c. Destructors can be overloaded but constructors cannot be overloaded.
d. Constructors and destructors can both return a value.
Q. Which of the following statement is correct?
a. C++ enables to define functions that take constants as an argument.
b. We cannot change the argument of the function that that are declared as constant.
c. Both A and B.
d. We cannot use the constant while defining the function.
Q. Which of the following statement is correct?
a. Two functions having same number of argument, order and type of argument can be overloaded if both functions do not have any default argument.
b. Overloaded function must have default arguments.
c. Overloaded function must have default arguments starting from the left of argument list.
d. A function can be overloaded more than once.
Q. Which of the following statement will be correct if the function has three arguments passedto it?
a. The trailing argument will be the default argument.
b. The first argument will be the default argument.
c. The middle argument will be the default argument.
d. All the argument will be the default argument.
Q. Which of the following statement is incorrect?
a. Default arguments can be provided for pointers to functions.
b. A function can have all its arguments as default.
c. Default argument cannot be provided for pointers to functions.
d. A default argument cannot be redefined in later declaration.
Q. Which of the following statement is correct?
a. Constructors can have default parameters.
b. Constructors cannot have default parameters.
c. Constructors cannot have more than one default parameter.
d. Constructors can have at most five default parameters.
Q. Which of the following function / type of function cannot be overloaded?
a. Member function
b. Static function
c. Virtual function
d. Both B and C
Q. Which of the following statement is incorrect?
a. The default value for an argument can be a global constant.
b. The default arguments are given in the function prototype.
c. Compiler uses the prototype information to build a call, not the function definition.
d. The default arguments are given in the function prototype and should be repeated in the function definition.
Q. Where the default value of parameter have to be specified?
a. Function call
b. Function definition
c. Function prototype
d. Both B or C
Q. Which of the following statement is correct?
a. The default value for an argument cannot be function call.
b. C++ allows the redefinition of a default parameter.
c. Both A and B.
d. C++ does not allow the redefinition of a default parameter.