C++ - QUESTIONS : PART 8
Only the …………………. can have access to the private members and private functions.
data functions
inline functions
member functions
member variables
SHOW ANSWER
Which of the following statements about member functions are True or False.
i) A member function can call another member function directly with using
the dot operator.
ii) Member function can access the private data of the class.
i-True, ii-True
i-False, ii-True
i-True, ii-False
i-True, ii-True
SHOW ANSWER
When the function is defined inside a class, it is treated as ………………….
data function
inline function
member function
member variable
SHOW ANSWER
A member function can be called by using its name inside another function of the same class, which is known as ………… of member function.
sub function
sub member
nesting
sibling
SHOW ANSWER
……………….. member variable is initialized to zero when the first object of its class is created where no other initialization is permitted.
friend
static
public
private
SHOW ANSWER
State whether the following statements are True or False about the characteristics of static data members.
i) Only one copy of static member is created for the entire class and is shared by all the objects of that class, no matter how many objects are created.
ii) Static member variable is visible only within the class, but its lifetime is the entire program.
i-True, ii-True
i-False, ii-True
i-True, ii-False
i-True, ii-True
SHOW ANSWER
Static variables are associated with the class itself rather than with any class object, they are also known as …………….
class variables
object variables
function variables
internal variables
SHOW ANSWER
Static variables are like ………………… as they are declared in a class declaration and defined in the source file.
inline member function
non inline member function
static member function
dynamic member function
SHOW ANSWER
A …………….. can have access to only other static members declared in the same class.
constant member function
private member function
static member function
friend function
SHOW ANSWER
A static member function can be called using the ………………… instead of its objects.
variable name
function name
Class name
object name
SHOW ANSWER
While using an object as a function argument, a copy of the entire object is passed to the function in ………….. method.
pass-by-value
pass-by-reference
pass-by-variable
pass-by-function
SHOW ANSWER
A ……………………., although not a member function, has full access rights to the private members of the class.
constant member function
private member function
static member function
friend function
SHOW ANSWER
……………. can be invoked like a normal function without the help of any object.
constant member function
private member function
static member function
friend function
SHOW ANSWER
A ………….. can only be called by another function that is member of its class.
constant member function
private member function
static member function
friend function
SHOW ANSWER
If a member function does not alter any data in the class, that may be declared as ………………..
constant member function
private member function
static member function
friend function
SHOW ANSWER
A class can contain objects of other classes and this phenomenon is called_________ .
Relationship
Object Association
Containership
None of these
SHOW ANSWER
Can we alter/modify the values of data members of a class inside const member function?
Yes
No
SHOW ANSWER
Can a class be declared/defined inside another class ?
Yes
No
SHOW ANSWER