Object Oriented Programming interview questions part 43
Object Oriented Programming interview questions part 43
Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. Which specifier allows to secure the public members of base class in inherited classes?
Correct Answer is : Private and Protected
2. What are public member functions?
Correct Answer is : Functions accessible everywhere using object of class
3. Which among the following is true for public member functions?
Correct Answer is : Public member functions can be called using object of class
4. Which type of member functions get inherited in the same specifier in which the inheritance is done? (If private inheritance is used, those become private and if public used, those become public)
Correct Answer is : Public member functions
5. Which syntax among the following is correct for public member functions?
Correct Answer is : public void functionName(parameters)
6. Which syntax is applicable to declare public member functions in C++?
Correct Answer is : public:
7. In java, which rule among the following is applicable?
Correct Answer is : Keyword public must be preceded with all the public members
8. How many public members are allowed in a class?
Correct Answer is : As many as required
9. Which is not a proper way to access public members of a class?
Correct Answer is : Using object of class with arrow operator
10. Which call is correct for public members of a nested class?
Correct Answer is : Can be called from object of enclosing class
11. Which public function call among the following is correct outside the class, if return type is void (C++)?
Correct Answer is : object.functionName(parameters);
12. If public members are to be restricted from getting inherited from the subclass of the class containing that function, which alternative is best?
Correct Answer is : Use private inheritance
13. A derived class object can access the public members of the base class.
Correct Answer is : FALSE
14. If a class have a public member function and is called directly in the main function then ___________________________
Correct Answer is : Undeclared function error will be produced
15. The function main() must always be public.
Correct Answer is : TRUE
16. All the public member functions ___________________
Correct Answer is : Can access all the member of its class
17. In which of the following way(s) can the object be returned from a function?
Correct Answer is : Can be returned either by value or reference
18. Whenever an object is returned by value ____________________
Correct Answer is : A temporary object is created
19. Where the temporary objects (created while return by value) are created?
Correct Answer is : Within the function
20. Which is the correct syntax for returning an object by value?