Friend function MCQs – C++
1. Where friend keyword placed for friend function?
(A). Function definition
(B). Function declaration
(c). Main function
(D). Both A and C
2. What is the syntax of friend function?
(A). class className
{ friend returnType functionName(parameters);};
(B). class className
{returnType friend functionName(parameters);};
(c). class className
{returnType functionName friend (parameters);};
(D). None of these
3. Friend function can access which kind of data members?
(A). Private
(B). Protected
(c). Both of these
(D). None of these
4. Global Function can be Friend functions for which of the following class?
(A). Base class
(B). Derived class
(c). Any classes
(D). None of these
5. If class B is declared friend inside class A, then what will happen?
(A). A can access data members of B
(B). B can access data members of A
(c). Both a and B
(D). None of these
6. A Function can be friend of how many classes at the same time?
(A). 1
(B). 2
(c). Many
(D). 1 or 2
7. Which of the following is true about friend function invocation?
(A). Friend function can be invoked using the object
(B). Friend function cannot be invoked using the object
(c). Both of these
(D). None of these
8. Friend functions have objects as___________?
(A). class
(B). arguments
(c). child
(D). Parent
OOP MCQs
- OOP intro & examples MCQs
- Classes and Inheritance MCQs
- Friend Function MCQs
- Virtual Function MCQs
- Polymorphism MCQs
- Polymorphism MCQs 2
- Operator overloading MCQs
- Object Oriented Programming MCQs – Very Important
Programming C Plus Plus MCQs Homepage
- Low-level and high-level languages MCQs
- Procedural and non Procedural languages MCQs
- C++ STANDARD LIBRARY MCQs
- Array MCQs
- Arrays MCQs 2
- Pointers Solved MCQs
- Inline Function MCQs – C++
- Top 50 Programming C++ MCQs
- MCQs of introduction to programming
- Past Papers 2022 C++ MCQs
- Past Papers 2021 C++ MCQs
- Past Papers 2020 C++ MCQs
- Past Papers 2019 C++ MCQs
- Highly Recommended C++ Important MCQs with Explanation
- OOP
- OOP intro & examples MCQs
- Classes and Inheritance MCQs
- Friend Function MCQs
- Virtual Function MCQs
- Polymorphism MCQs
- Polymorphism MCQs 2