
C++ Friend Functions and Classes Quiz
Authored by Satheesh D
Computers
12th Grade
Used 3+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
13 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What keyword is used to declare a friend function in C++?
friend
private
friend_function
access
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Where should the declaration of a friend function be placed?
In a separate file
Outside the class
Inside the class body
In the main function
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Can a friend function access private data of a class?
No
Yes
Only if declared public
Only if it's a member function
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is true about a friend function?
It cannot access private members
It is a member of the class
It can be called like a normal function
It must be defined inside the class
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What can a friend class access?
Only public members
Only static members
Only private members
Both private and protected members
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is NOT a characteristic of a friend function?
It can be declared in public or private
It can access private members
It cannot be called using an object
It is in the scope of the class
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the syntax for declaring a global function as a friend function?
friend return_type function_name(arguments);
global friend function_name(arguments);
friend function_name(arguments);
function_name(arguments) as friend;
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?