Explore topic-wise MCQs in Object Oriented Programming Using C++.

This section includes 2 Mcqs, each offering curated multiple-choice questions to sharpen your Object Oriented Programming Using C++ knowledge and support exam preparation. Choose a topic below to get started.

1.

Choose the correct option for the code given below.
class A{ static int c=0; public: A(){ c++; } };

A. Constructor will make c=1 for each object created
B. Constructor will make c=0 for each object created
C. Constructor will keep number of objects created
D. Constructor will just initialize c=0 then increment by 1
Answer» D. Constructor will just initialize c=0 then increment by 1
2.

If private members have to be accessed directly from outside the class but the access specifier must not be changed, what should be done?

A. Specifier must be changed
B. Friend function should be used
C. Other public members should be used
D. It is not possible
Answer» C. Other public members should be used