← All topics
Quiz: Operators and Templates: questions with answers
10 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. Why is operator<< usually a non-member (often friend) function?
- Q2. Which operator can NOT be overloaded in C++?
- Q3. What does this print? (code)
- Q4. Is friendship inherited by derived classes?
- Q5. What is vector<int an example of?
- Q6. What does this print? (code)
- Q7. For a member operator+, what does the expression a + b become?
- Q8. What does this print? (code)
- Q9. When does the compiler generate code from a function template?
- Q10. What does a friend function of a class get that an ordinary function does not?