(A) public
(B) private
(C) protected
(D) None of the above
Tag: Object Oriented Programming Mcqs
Consider the following two lines of code written for a class Student, 1. Student sobj1,sobj2; 2. sobj2 = sobj1; In line No.2 what constructor of Student class will be called?
(A) Default constructor of Student class
(B) Copy constructor of student class
(C) Both default and copy constructer of Student class
(D) No constructor will be called
Child class can call constructor of its?
(A) Direct base class
(B) Indirect base class
(C) Both direct and indirect base classes
(D) None of the above
In private inheritance derived class pointer can be assigned to base class pointer in?
(A) Main function
(B) In derived class member and friend functions
(C) In base class member and friend functions
(D) None of the above
In case of dynamic memory allocation in a class we should use?
(A) User defined default constructor
(B) User defined copy constructor
(C) Both of the above
(D) None of the above
Consider the code below, class class1{ public: void func1(); }; class class2 : protected class1 { }; Function func1 of class1 is __ in class2.
(A) protected
(B) public
(C) private
(D) None of the above
Only tangible things can be chosen as an object.
(A) True
(B) False
Which of the following may not be an integral part of an object?
(A) Behavior
(B) State
(C) Protected data members
(D) All of the above