Explore topic-wise MCQs in Object Oriented Programming.

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

1.

Which member can be considered most secure in the code below?

A. a
B. b
C. c
D. dView Answer
Answer» C. c
2.

Which data member in following code will be used whenever an object is created?

A. x will be used
B. y will be used
C. z will be used
D. All will be usedView Answer
Answer» D. All will be usedView Answer
3.

Private member functions can be overloaded.

A. True
B. False
Answer» B. False
4.

Which member will never be used from the following class?

A. name variable will never be used
B. marks variable will never be used
C. constructor will never be used
D. disp() function will never be usedView Answer
Answer» B. marks variable will never be used
5.

Which option is false for the following code?

A. Constructor can be created with zero argument
B. Constructor prints sum, if two parameters are passed with object creation
C. Constructor will give error if float values are passed
D. Constructor will take 0 as default value of parameters if not passedView Answer
Answer» E.
6.

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
7.

Which access specifier is/are most secure during inheritance?

A. Private
B. Default
C. Protected
D. Private and default
Answer» B. Default
8.

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
9.

Which among the following is correct to call a private member from outside the class?

A. object.memberfunction( parameters );
B. object->memberfunction( parameters );
C. object->memberfunction( parameteres); or object.memberfunction( parameters );
D. Not possible
Answer» E.
10.

Which among the following is true for the code given below?

A. Objects can be created with one parameter or without parameter
B. Object can be created only with one parameter
C. Object can be created with more than one parameter
D. Objects can be create only without parameterView Answer
Answer» B. Object can be created only with one parameter
11.

Which among the following is correct for the code given below?

A. The object can never be created
B. The object can be created without parameters
C. Only the object with only 1 parameter can be created
D. Only the object with some parameters can be createdView Answer
Answer» D. Only the object with some parameters can be createdView Answer
12.

If a function has to be called only by using other member functions of the class, what should be the access specifier used for that function?

A. Private
B. Protected
C. Public
D. Default
Answer» B. Protected
13.

CHOOSE_THE_CORRECT_OPTION_FOR_THE_CODE_GIVEN_BELOW?$

A. { c++; } };
B. Constructor will make c=1 for each object created
C. Constructor will make c=0 for each object created
D. Constructor will keep number of objects created
Answer» B. Constructor will make c=1 for each object created
14.

name variable will never be used

A. marks variable will never be used
B. constructor will never be used
C. disp() function will never be used
Answer» C. disp() function will never be used
15.

Objects can be created with one parameter or without parameter

A. Object can be created only with one parameter
B. Object can be created with more than one parameter
C. Objects can be create only without parameter
Answer» C. Objects can be create only without parameter
16.

The object can never be created

A. The object can be created without parameters
B. Only the object with only 1 parameter can be created
C. Only the object with some parameters can be created
Answer» B. Only the object with only 1 parameter can be created