Friend Functions and Friend Classes – MCQs

30 Score: 0 Attempted: 0/30 Subscribe
1. : What is a friend function in C++?





2. : Which keyword is used to declare a friend function?





3. : Can a friend function be a member of a class?





4. : Where is a friend function defined?





5. : Can friend functions access private data members of a class?





6. : Which of the following is true about friend functions?





7. : Can a friend function be declared as virtual?





8. : What is a friend class?





9. : Which keyword is used to declare a friend class?





10. : What can a friend class access?





11. : Can a friend function be overloaded?





12. : Are friend functions inline by default?





13. : Can a friend function access protected members of a class?





14. : How is a friend function different from a member function?





15. : Can a friend function of one class be a member of another class?





16. : Can a friend function be a global function?





17. : Which access modifier is used with friend functions?





18. : What is required for a function to be a friend function of a class?





19. : Can a class declare another class as a friend more than once?





20. : Are friend functions inherited in derived classes?





21. : Can a function be friend to more than one class?





22. : Can a friend function be declared in multiple classes?





23. : What kind of relationship does a friend function violate in OOP?





24. : Can a friend function be a template function?





25. : How many friend classes can a class have?





26. : Where is the friend function prototype written?





27. : How can a friend function be called?





28. : What is one major drawback of friend functions?





29. : What is the scope of a friend function?





30. : What is needed to allow a function from one class to access private members of another?





Leave a Comment

All copyrights Reserved by MCQsAnswers.com - Powered By T4Tutorials