C++ Programming :: Templates

Home > C++ Programming > Templates > General Questions

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

2 / 33

 Which of the following can be passed to function template as an argument?

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

3 / 33

 The desired type is added to a specific template class instantiation by placing the type's name

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

7 / 33

 What is the output of the below C++ program?

#include < iostream >
#include < string >
using namespace std;
template < typename T >
void print_mydata(T output)
{
cout << output << endl;
}
int main()
{
double d = 5.5;
string s("Hello World");
print_mydata( d );
print_mydata( s );
return 0;
}

Answer: Option A

Explanation:

Passing the value to template and printig it in template.

Workspace


Tags:  No Tags on this question yet!

8 / 33

 How many types of templates are there in c++?

Answer: Option B

Explanation:

function template
class template

Workspace


Tags:  No Tags on this question yet!

Answer: Option A

Explanation:

A template is a formula for creating a generic class

Workspace


Tags:  No Tags on this question yet!

Answer: Option A

Explanation:

A template parameter is a special kind of parameter that can be used to pass a type as argument.

Workspace


Tags:  No Tags on this question yet!