
C++ Friend Function Quiz
Authored by MARY T
Other

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a friend function in C++?
A friend function in C++ is a function that can only be called from within the class.
A friend function in C++ is a function that can only access the public members of a class.
A friend function in C++ is a function that has access to the private and protected members of a class.
A friend function in C++ is a function that can be called from any other class except the one it is declared in.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the syntax of a friend function in C++?
friend return_type function_name(parameters);
friend return_type function_name;
friend function_name;
friend function_name(parameters);
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can a friend function access private members of a class in C++?
By being declared as a friend inside the class
By using the 'static' keyword
By using the 'protected' access specifier
By using the 'public' access specifier
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Can a friend function be a member of a class hierarchy in C++?
No
Yes
Sometimes
Only in certain cases
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the difference between a friend function and a member function in C++?
A friend function is not a member of a class, while a member function is a member of a class.
A friend function can be called without an object, while a member function can only be called using an object.
A friend function is declared inside a class, while a member function is declared outside the class.
A friend function can only access public members of a class, while a member function can access both public and private members.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
True or False: A friend function can access protected members of a class in C++.
False
True
Only if the friend function is a member of the class
Only if the friend function is declared in the same file as the class
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
True or False: A friend function can be declared in the private section of a class in C++.
Only in derived classes
False
True
Only in public section
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?
Similar Resources on Wayground
10 questions
SCIENCE - LIGHT ENERGY
Quiz
•
5th Grade
10 questions
Latihan Kelas 2 T5 Sub4
Quiz
•
2nd Grade
10 questions
PRETEST P1 DASAR DASAR BAHAN ALAM
Quiz
•
University
10 questions
Wonder Woman Personaje
Quiz
•
7th Grade
10 questions
Quiz de Introducción a la Computación
Quiz
•
1st Grade
9 questions
Sustantivos,pronombres,verbos y adjetivos
Quiz
•
4th Grade
15 questions
Practice for Test Unit 10 Expressions and Equations
Quiz
•
5th Grade
10 questions
El dedo mágico. Roald Dahl
Quiz
•
3rd - 4th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Other
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade