Explore topic-wise MCQs in Object Oriented Programming.

This section includes 21 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 not possible for member function?

A. Access protected members of parent class
B. Definition without return type
C. Access public members of subclass
D. Access static members of class
Answer» D. Access static members of class
2.

Which member function doesn’t require any return type?

A. Static
B. Constructor
C. Const
D. Constructor and destructor
Answer» E.
3.

A member function can _______________ of the same class.

A. Call other member functions
B. Call only private member functions
C. Call only static member functions
D. Call only const member functions
Answer» B. Call only private member functions
4.

Which among the following is proper syntax for class given below?

A. void disp::A(){ }
B. void A::disp(){ }
C. void A:disp() { cout<<a<<b ; }
D. void disp:A(){ cout<<a<<b; }View Answer
Answer» C. void A:disp() { cout<<a<<b ; }
5.

Member function of a class can ____________

A. Access all the members of the class
B. Access only Public members of the class
C. Access only the private members of the class
D. Access subclass members
Answer» B. Access only Public members of the class
6.

Member functions of a generic class are _____________

A. Not generic
B. Automatically generic
C. To be made generic explicitly
D. Given default type as double
Answer» C. To be made generic explicitly
7.

If a virtual member function is defined ___________

A. It should not contain any body and defined by subclasses
B. It must contain body and overridden by subclasses
C. It must contain body and be overloaded
D. It must not contain any body and should not be derived
Answer» B. It must contain body and overridden by subclasses
8.

For overloading “( )”, “[ ]” or “->” operators, a class __________

A. Must use static member functions
B. Must use non-static member functions
C. Must be non-static member and should not be friend of class
D. Must use static member function or a friend member function
Answer» D. Must use static member function or a friend member function
9.

How to access members of the class inside a member function?

A. Using this pointer only
B. Using dot operator
C. Using arrow operator
D. Used directly or with this pointer
Answer» E.
10.

Static member functions _____________

A. Contains “this” pointer for data members
B. Contains “this” pointer if used for member functions
C. Doesn’t contain “this” pointer
D. Doesn’t contain “this” pointer if member functions are referred
Answer» D. Doesn’t contain “this” pointer if member functions are referred
11.

What happens if non static members are used in static member function?

A. Compile time error
B. Runtime error
C. Executes fine
D. Executes if that member function is not used
Answer» B. Runtime error
12.

What are inline member functions?

A. Member functions which can be called without object
B. Member functions whose definition is expanded in place of its call
C. Member functions whose definition is faster than simple function
D. Member function which is defined in single line
Answer» C. Member functions whose definition is faster than simple function
13.

How can a static member function be called in the main function?

A. Using dot operator
B. Using arrow operator
C. Using dot or arrow operator
D. Using dot, arrow or using scope resolution operator with class name
Answer» E.
14.

How many types of member functions are generally there in C++?

A. 2
B. 3
C. 4
D. 5
Answer» E.
15.

Which among the following best describes member functions?

A. Functions which are defined within the class
B. Functions belonging a class
C. Functions in public access of a class
D. Functions which are private to class
Answer» C. Functions in public access of a class
16.

MEMBER_FUNCTIONS_OF_A_GENERIC_CLASS_ARE______________?$

A. Not generic
B. Automatically generic
C. To be made generic explicitly
D. Given default type as double
Answer» C. To be made generic explicitly
17.

Member function of a class can ____________$

A. Access all the members of the class
B. Access only Public members of the class
C. Access only the private members of the class
D. Access subclass members
Answer» B. Access only Public members of the class
18.

Which member function doesn’t require any return type?$

A. Static
B. Constructor
C. Const
D. Constructor and destructor
Answer» D. Constructor and destructor
19.

void disp::A(){ }

A. void A::disp(){ }
B. void A:disp() { cout<<a<<b ; }
C. void disp:A(){ cout<<a<<b; }
Answer» B. void A:disp() { cout<<a<<b ; }
20.

If a virtual member function is defined, __________?

A. It should not contain any body and defined by subclasses
B. It must contain body and overridden by subclasses
C. It must contain body and be overloaded
D. It must not contain any body and should not be derived
Answer» B. It must contain body and overridden by subclasses
21.

For overloading “( )”, “[ ]” or “->” operators, a class __________$

A. Must use static member functions
B. Must use non-static member functions
C. Must be non-static member and should not be friend of class
D. Must use static member function or a friend member function
Answer» D. Must use static member function or a friend member function