Olete.in
Articles
Mock Tests
đź§Ş OOPS MCQ Quiz Hub
OOPS Mcq Question Set 3
Choose a topic to test your knowledge and improve your OOPS skills
1. How is it possible to have both const and non-const version of a function?
Function overriding
Function prototyping
Function overloading
Function declaring
2. When both the const and non-const version of functions are required?
Return value have to be different in const
Return value have to be same in const
Return values have to be ignored
Return values have to be suppressed
3. If a function is to be made const, which is the correct syntax?
const functionName(parameters);
const returnType functionName(parameters);
const functionName(returnType)(Parameters);
const (functionName(parameters));
4. Functions which differ in const-ness are considered _________
To have same signature
To have different signature
To produce compile time error
To produce runtime error
5. If const version of a function when overloading is used, the function ______
Returns reference to object
Returns volatile reference
Returns mutable reference
Returns const reference
6. Which among the following is recommended for const functions?
Const function use should be reduced in a program
Const function use should be more in a program
Const function use should not matter in a program
Const function use should be able to modify the values
7. Use of const member function in a program ______
Is mandatory, always
Is optional, always
Is mandatory, if objects are used
Is optional, if const objects are used
8. How many types of member functions are possible in general?
2
3
4
5
9. Simple member functions are ________
Ones defined simply without any type
Ones defined with keyword simple
Ones that are implicitly provided
Ones which are defined in all the classes
10. What are static member functions?
Functions which use only static data member but can’t be accessed directly
Functions which uses static and other data members
Functions which can be accessed outside the class with the data members
Functions using only static data and can be accessed directly in main() function
11. How can static member function can be accessed directly in main() function?
Dot operator
Colon
Scope resolution operator
Arrow operator
12. Correct syntax to access the static member functions from the main() function is _______
classObject::functionName();
className::functionName();
className:classObject:functionName();
className.classObject:functionName();
13. What are const member functions?
Functions in which none of the data members can be changed in a program
Functions in which only static members can be changed
Functions which treat all the data members as constant and doesn’t allow changes
Functions which can change only the static members
14. Which among the following best describes the inline member functions?
Functions defined inside the class only
Functions with keyword inline only
Functions defined outside the class
Functions defined inside the class or with the keyword inline
15. What are friend member functions (C++)?
Member function which can access all the members of a class
Member function which can modify any data of a class
Member function which doesn’t have access to private members
Non-member functions which have access to all the members (including private) of a class
16. What is the syntax of a const member function?
void fun() const {}
void fun() constant {}
void const fun() {}
const void fun(){}
17. Which keyword is used to make a nonmember function as friend function of a class?
friendly
new
friend
Connecting lines
18. Member functions ______
Must be defined inside class body
Can be defined inside class body or outside
Must be defined outside the class body
Can be defined in another class
19. All type of member functions can’t be used inside a single class.
True
False
all of the above
None of the mentioned
20. Which among the following is true?
Member functions can never be private
Member functions can never be protected
Member functions can never be public
Member functions can be defined in any access specifier
21. Which keyword is used to define the static member functions?
static
stop
open
State
22. Which keyword is used to define the inline member function?
no keyword required
inline
inlined
line
23. 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
24. How many types of member functions are generally there in C++?
2
3
4
5
25. How can a static member function be called in the main function?
Using dot operator
Using arrow operator
Using dot or arrow operator
Using dot, arrow or using scope resolution operator with class name
26. What are inline member functions?
Member functions which can be called without object
Member functions whose definition is expanded in place of its call
Member functions whose definition is faster than simple function
Member function which is defined in single line
27. How to access members of the class inside a member function?
Using this pointer only
Using dot operator
Using arrow operator
Used directly or with this pointer
28. For overloading “( )”, “[ ]” or “->” operators, a class _____
Must use static member functions
Must use non-static member functions
Must be non-static member and should not be friend of class
Must use static member function or a friend member function
29. If a virtual member function is defined _________
It should not contain any body and defined by subclasses
It must contain body and overridden by subclasses
It must contain body and be overloaded
It must not contain any body and should not be derived
30. Member functions of a generic class are ______
Not generic
Automatically generic
To be made generic explicitly
Given default type as double
31. Member function of a class can ______
Access all the members of the class
Access only Public members of the class
Access only the private members of the class
Access subclass members
32. Which among the following is proper syntax for class given below? class A { int a,b; public : void disp(); }
void disp::A(){ }
void A::disp(){ }
void A:disp() { cout<<a<<b ; }
void disp:A(){ cout<<a<<b; }
33. A member function can _____ of the same class.
Call other member functions
Call only private member functions
Call only static member functions
Call only const member functions
34. Which member function doesn’t require any return type?
Static
Constructor
Const
Constructor and destructor
35. Which among the following is not possible for member function?
Access protected members of parent class
Definition without return type
Access public members of subclass
Access static members of class
36. Which among the following is correct definition for static member functions?
Functions created to allocate constant values to each object
Functions made to maintain single copy of member functions for all objects
Functions created to define the static members
Functions made to manipulate static programs
37. Which is correct syntax to access the static member functions with class name?
className . functionName;
className -> functionName;
className : functionName;
className :: functionName;
38. Which among the following is not applicable for the static member functions?
Variable pointers
void pointers
this pointer
Function pointers
39. Which among the following is true?
Static member functions can’t be virtual
Static member functions can be virtual
Static member functions can be declared virtual if it is pure virtual class
Static member functions can be used as virtual in Java
40. The static members are _______
Created with each new object
Created twice in a program
Created as many times a class is used
Created and initialized only once
41. Which among the following is true?
Static member functions can be overloaded
Static member functions can’t be overloaded
Static member functions can be overloaded using derived classes
Static member functions are implicitly overloaded
42. The static member functions ______
Can’t be declared const
Can’t be declared volatile
Can’t be declared const or volatile
Can’t be declared const, volatile or const volatile
43. Which keyword should be used to declare the static member functions?
static
stat
const
Common
44. The keyword static is used ______
With declaration inside class and with definition outside the class
With declaration inside class and not with definition outside the class
With declaration and definition wherever done
With each call to the member function
45. Which among the following can’t be used to access the members in any way?
Scope resolution
Arrow operator
Single colon
Dot operator
46. We can use the static member functions and static data member _______
Even if class object is not created
Even if class is not defined
Even if class doesn’t contain any static member
Even if class doesn’t have complete definition
47. The static data member ________
Can be mutable
Can’t be mutable
Can’t be integer
Can’t be characters
48. If static data member are made inline, ______
Those should be initialized outside the class
Those can’t be initialized with the class
Those can be initialized within the class
Those can’t be used by class members
49. Which among the following best describes member function overriding?
Member functions having same name in base and derived classes
Member functions having same name in base class only
Member functions having same name in derived class only
Member functions having same name and different signature inside main function
50. Which among the following is true?
Inheritance must not be using when overriding is used
Overriding can be implemented without using inheritance
Inheritance must be done, to use overriding are overridden
Inheritance is mandatory only if more than one functions
Submit