
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
Similar Resources on Wayground
15 questions
Minigame CLB Tin học 20/10

Quiz
•
University
10 questions
HTML + CSS + JS

Quiz
•
University
10 questions
23CSR306_Unit I

Quiz
•
University
15 questions
Lista de Exercícios – Vetores em Java - Parte I

Quiz
•
University
10 questions
Практикум №1

Quiz
•
University
7 questions
QUIZ SBD WEEK#11

Quiz
•
University
12 questions
Data Struct - S1_Array & Pointer

Quiz
•
University
15 questions
Bài 27

Quiz
•
10th Grade - University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Information Technology (IT)
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University