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 among the following is wrong syntax related to static data members?

A. className :: staticDataMember;
B. dataType className :: memberName =value;
C. static dataType memberName;
D. className : dataType -> memberName;
Answer» E.
2.

If object of class are created, then the static data members can be accessed ____________

A. Using dot operator
B. Using arrow operator
C. Using colon
D. Using dot or arrow operator
Answer» E.
3.

Whenever any static data member is declared in a class ______________________

A. Only one copy of the data is created
B. New copy for each object is created
C. New memory location is allocated with each object
D. Only one object uses the static data
Answer» B. New copy for each object is created
4.

Which data members among the following are static by default?

A. extern
B. integer
C. const
D. void
Answer» D. void
5.

Which among the following is the correct syntax to access static data member without using member function?

A. className -> staticDataMember;
B. className :: staticDataMember;
C. className : staticDataMember;
D. className . staticDataMember;
Answer» C. className : staticDataMember;
6.

The static data member __________________________

A. Can be accessed directly
B. Can be accessed with any public class name
C. Can be accessed with dot operator
D. Can be accessed using class name if not using static member function
Answer» E.
7.

If static data members have to be used inside a class, those member functions _______________

A. Must not be static member functions
B. Must not be member functions
C. Must be static member functions
D. Must not be member function of corresponding class
Answer» D. Must not be member function of corresponding class
8.

The syntax for defining the static data members is __________

A. dataType className :: memberName = value;
B. dataType className : memberName = value;
C. dataType className . memberName = value;
D. dataType className -> memberName =value;
Answer» B. dataType className : memberName = value;
9.

The static data member ______________________

A. Must be defined inside the class
B. Must be defined outside the class
C. Must be defined in main function
D. Must be defined using constructor
Answer» C. Must be defined in main function
10.

Which is the correct syntax for declaring static data member?

A. static mamberName dataType;
B. dataType static memberName;
C. memberName static dataType;
D. static dataType memberName;
Answer» E.
11.

Any changes made to static data member from one member function _____________

A. Is reflected to only the corresponding object
B. Is reflected to all the variables in a program
C. Is reflected to all the objects of that class
D. Is constant to that function only
Answer» D. Is constant to that function only
12.

Which keyword should be used to declare static variables?

A. static
B. stat
C. common
D. const
Answer» B. stat
13.

Which among the following best defines static variables members?

A. Data which is allocated for each object separately
B. Data which is common to all the objects of a class
C. Data which is common to all the classes
D. Data which is common to a specific method
Answer» C. Data which is common to all the classes
14.

WHICH_DATA_MEMBERS_AMONG_THE_FOLLOWING_ARE_STATIC_BY_DEFAULT??$

A. extern
B. integer
C. const
D. void
Answer» D. void
15.

WHICH_AMONG_THE_FOLLOWING_IS_CORRECT_SYNTAX_TO_ACCESS_STATIC_DATA_MEMBER_WITHOUT_USING_MEMBER_FUNCTION??$

A. className -> staticDataMember;
B. className :: staticDataMember;
C. className : staticDataMember;
D. className . staticDataMember;
Answer» C. className : staticDataMember;
16.

20 22$

A. 20 21
B. 21 22
C. 22 23
Answer» B. 21 22