(A) Simple Association
(B) Inheritance
(C) Aggregation
(D) Composition
Tag: OOP Mcqs
We achieve independence of internal implementation from its external interface through?
(A) Information hiding
(B) Encapsulation
(C) Abstraction
(D) Both encapsulation and information hiding
Suppose that the Test class does not have an overloaded assignment operator. What happens when an assignment a=b; is given for two Test objects a and b?
(A) The automatic assignment operator is used
(B) The copy constructor is used
(C) Compiler error
(D) Run time error
Friend class and friend function can be used as an alternate to each other.
(A) True
(B) False
Given the following class class Base { int Age=33; } How you can improve above class with respect to accessing the field Age?
(A) Define the variable Age as private
(B) Define the variable Age as protected
(C) Define the variable Age as private and create a get method that returns it and a set method that updates it
(D) Define the variable Age as protected and create a set method that returns it and a get method that updates it
C++ compiler does not allow to dynamically allocate memory for objects.
(A) True
(B) False
__ is/are used to access information hidden within an object.
(A) Private data members
(B) Private member functions
(C) Interface
(D) None of the above
What a derived class can add?
(A) New data members
(B) New member functions and New friend functions
(C) New constructors and destructor
(D) All of the above