(A) const
(B) static
(C) friend
(D) private
Tag: OOP Mcqs
Assume a class C with objects obj1, obj2, and obj3. For the statement obj3 = obj1 – obj2 to work correctly, if the overloaded – operator must?
(A) Take two arguments
(B) Create a named temporary object
(C) Return a value
(D) Take four arguments
Which of the following operators always takes no argument if overloaded?
(A) –
(B) /
(C) +
(D) ++
The main function of scope resolution operator (::) is,?
(A) To define a data member
(B) To define an object
(C) To link the definition of an identifier to its declaration
(D) All of the above
What is a class?
(A) A class is a section of computer memory containing objects
(B) A class is a section of the hard disk reserved for object oriented programs
(C) A class is the part of an object that contains the variables
(D) A class is a description of a kind of object
Which one of the following features of OOP is used to derive a class from another?
(A) Polymorphism
(B) Data hiding
(C) Encapsulation
(D) Inheritance
A C++ class is similar to?
(A) Structure
(B) Header file
(C) Library file
(D) None of the above
To convert from a user-defined class to a basic type, you would most likely use?
(A) A built-in conversion operator
(B) A one-argument constructor
(C) An overloaded = operator
(D) A conversion operator that‘s a member of the class