MCQGeeks
0 : 0 : 1
CBSE
JEE
NTSE
NEET
English
UK Quiz
Quiz
Driving Test
Practice
Games
Quiz
Object Oriented Programming Oops
Object Oriented Programming Multiple Choice
Quiz 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Q.1
Which is private member functions access scope?
a) Member functions which can only be used within the class
b) Member functions which can used outside the class
c) Member functions which are accessible in derived class
d) Member functions which can’t be accessed inside the class
Q.2
Which among the following is true?
a) The private members can’t be accessed by public members of the class
b) The private members can be accessed by public members of the class
c) The private members can be accessed only by the private members of the class
d) The private members can’t be accessed by the protected members of the class
Q.3
Which member can never be accessed by inherited classes?
a) Private member function
b) Public member function
c) Protected member function
d) All can be accessed
Q.4
Which syntax among the following shows that a member is private in a class?
a) private: functionName(parameters)
b) private(functionName(parameters))
c) private functionName(parameters)
d) private::functionName(parameters)
Q.5
If private member functions are to be declared in C++ then _____________
a) private: <all private members>
b) private <member name>
c) private(private member list)
d) private :- <private members>
Q.6
In java, which rule must be followed?
a) Keyword private preceding list of private member’s
b) Keyword private with a colon before list of private member’s
c) Keyword private with arrow before each private member
d) Keyword private preceding each private member
Q.7
How many private member functions are allowed in a class?
a) Only 1
b) Only 7
c) Only 255
d) As many as required
Q.8
How to access a private member function of a class?
a) Using object of class
b) Using object pointer
c) Using address of member function
d) Using class address
Q.9
Private member functions ____________
a) Can’t be called from enclosing class
b) Can be accessed from enclosing class
c) Can be accessed only if nested class is private
d) Can be accessed only if nested class is public
Q.10
Which function among the following can’t be accessed outside the class in java in same package?
a) public void show()
b) void show()
c) protected show()
d) static void show()
Q.11
If private members are to be called outside the class, which is a good alternative?
a) Call a public member function which calls private function
b) Call a private member function which calls private function
c) Call a protected member function which calls private function
d) Not possible
Q.12
A private function of a derived class can be accessed by the parent class.
a) True
b) False
Q.13
Which error will be produced if private members are accessed?
a) Can’t access private message
b) Code unreachable
c) Core dumped
d) Bad code
Q.14
Can main() function be made private?
a) Yes, always
b) Yes, if program doesn’t contain any classes
c) No, because main function is user defined
d) No, never
Q.15
If a function in java is declared private then it __________________
a) Can’t access the standard output
b) Can access the standard output
c) Can’t access any output stream
d) Can access only the output streams
0 h : 0 m : 1 s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Report Question
×
What's an issue?
Question is wrong
Answer is wrong
Other Reason
Want to elaborate a bit more? (optional)
Support mcqgeeks.com by disabling your adblocker.
×
Please disable the adBlock and continue.
Thank you.
Reload page