
C++ Templates Quiz
Quiz
•
Information Technology (IT)
•
University
•
Hard
Yasmin Kandil
Used 10+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a template in C++?
A predefined function
A blueprint for creating functions or classes
A type of variable
A keyword in C++
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a correct way to define a function template?
`template function<int> void func() {}`
`template <typename T> void func() {}`
`function template<T> void func() {}`
`template <T> void func() {}`
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the primary benefit of using templates in C++?
Improved performance
Code reuse and type safety
Simplicity of syntax
Increased memory usage
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following statements about class templates is true?
Class templates cannot have member functions.
Class templates are not type safe.
Class templates can be instantiated with different types.
Class templates require a return type.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you instantiate a template class with the type `int`?
`MyClass<int> obj;`
`MyClass obj<int>;`
`MyClass obj(int);`
`MyClass<int> obj();`
6.
MULTIPLE SELECT QUESTION
45 sec • 1 pt
What keyword is used to define a template parameter that can accept any type?
`var`
`template`
`typename`
`class`
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is an example of a template specialization?
`MyClass<int> obj();`
`template<> void func<int>() {}`
`template<type T> void func() {}`
`void func() {}`
Create a free account and access millions of resources
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
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
11 questions
8 клас 11 балів
Quiz
•
8th Grade - University
10 questions
HTML
Quiz
•
12th Grade - University
10 questions
Website Quiz
Quiz
•
University
13 questions
Asesmen Awal
Quiz
•
10th Grade - University
10 questions
Quizzi bài 29 Tin học 10
Quiz
•
10th Grade - University
10 questions
Tin 9 Bài 8. SUMIF
Quiz
•
9th Grade - University
10 questions
Quiz on Basics of C
Quiz
•
University
15 questions
Массив
Quiz
•
University
Popular Resources on Wayground
20 questions
Halloween Trivia
Quiz
•
6th - 8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
15 questions
Order of Operations
Quiz
•
5th Grade
20 questions
Halloween
Quiz
•
5th Grade
16 questions
Halloween
Quiz
•
3rd Grade
12 questions
It's The Great Pumpkin Charlie Brown
Quiz
•
1st - 5th Grade
20 questions
Possessive Nouns
Quiz
•
5th Grade
10 questions
Halloween Traditions and Origins
Interactive video
•
5th - 10th Grade
Discover more resources for Information Technology (IT)
10 questions
Halloween Movies Trivia
Quiz
•
5th Grade - University
12 questions
Halloween
Quiz
•
3rd Grade - University
5 questions
Using Context Clues
Interactive video
•
4th Grade - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
14 questions
Eat Healthy,Be Healty
Quiz
•
4th Grade - University
7 questions
History of Halloween: Pagan or Christian?
Interactive video
•
11th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
