Class Members Mcqs

Our collections of Multiple choice questions and answers focuses on study of Class Members in OOP. These questions are chosen from a collection of most authoritative and best reference books on OOP. Our aim is to prepare an individual for competitive exams like NTS, Web Developer | IOS Developer | Game Developer | Software House interviews and jobs, University and College entrance exams and various tests and job interviews. One should practice our Mcqs to assimilate Class Members in OOP comprehensively.

2.
Data members ________________ (C++)

Can be initialized with declaration in classes

Can be initialized only with help of constructors

Can be initialized either in declaration or by constructor

Can’t be initialized

3.
Which among the following is true for data members?

Private data members can be initialized with declaration in class

Static members are initialized in constructors

Protected data members can be initialized in class directly

Static data members are defined outside class, not in constructor

4.
What should be done for data member to be of user defined structure type?

The structure must have been defined before class.

The structure must have been defined after the class definition

The structure must be predefined

The structure type data members can’t be used

7.
To create a pointer to a private data member of a class, outside the class, which among the following is correct?

Return the address of the private data member using a member function

Access the private member using a pointer outside class

Declare the member as pointer inside the class

Not possible to create pointer to a private member

8.
Which among the following is true for use of setter() and getter() function?

Considered best for manipulating data values

Considered the only proper way to manipulate the values

Considered specially for private members manipulation

Considered a red flag, and not recommended for large scale use

14.
Which among the following best describes member functions?

Functions which are defined within the class

Functions belonging a class

Functions in public access of a class

Functions which are private to class

16.
How can a static member function be called in main function?

Using dot operator

Using arrow operator

Using dot or arrow operator

Using dot, arrow or using scope resolution operator with class name

0Shares
0
Scroll to Top