CS304P Quiz 4 by Shahid and Ziddi
- Type
- Quiz
- Course
- CS304P Object Oriented Programming (Practical)
- Size
- PDF 845 KB
- Updated
- 23 Oct 2026
You get 3 free files a day on the website. Add the Chrome extensionSign in with the extension for 30 a day.
Preview text
Text from pages 1, 2 of 2. Download the file for all 2 pages.
Q1. Which of the following is true about friend functions in template classes?
Correct answer: They can access private and protected members of the class.
Q2. What keyword is used to define a generic function template?
Correct answer: template
Q3. If a function template has parameters `T` and `U`, calling `func(1, 2.5)` results in:
Correct answer: T=int, U=double
Q4. When is a class template instantiated?
Correct answer: At compile time
Q5. Which of the following is the correct syntax for creating a template class X friend of a template class Y?
Correct answer: friend X<T>;
Q6. What feature enables same-named template functions to exist?
Correct answer: Specialization
Q7. Which keyword is used to define a template in C++?
Correct answer: template
Q8. To accept two type parameters, __________ is written.
Correct answer: template<typename T, typename U>
Q9. Which of the following is the correct syntax for creating a function Test(T) friend of a template class?
Correct answer: friend void Test(T);
Q10. Which of the following is an example of partial specialization?
Correct answer: template<class T, float>
Related CS304P files
All CS304P files →Get more out of VUBuddy, for free
- Unlimited downloads
- The explanation behind every MCQ answer
- Study offline on slow data
- 30 downloads a day instead of 3
- Sign in and buy Pro Semester here
One Pro Semester membership works in both the extension and the app.