MCQs
Total Questions : 5
Answer: Option C. -> 3
There are three kinds of parameters are there in C++. They are type, non-type, template.
Answer: Option C. -> 3
C++ allows us to parameterize directly three kinds of entities through templates: types, constants,
and templates.
Answer: Option D. -> 1342
In this program, We are printing the order of execution of constructor and destructor in the class.
Output:
$ g++ dert4.cpp
$ a.out
1342
Question 4.
1.
#include
2.
using namespace std;
3.
template
4.
class Test
5.
{
6.
public:
7.
Test();
8.
~Test();
9.
type Data(type);
10.
};
11.
template
12.
type Test::Data(type Var0)
13.
{
14.
return Var0;
15.
}
16.
template
17.
Test::Test()
18.
{
19.
}
20.
template
21.
Test::~Test()
22.
{
23.
}
24.
int main(void)
25.
{
26.
Test Var3;
27.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
template
4.
class Test
5.
{
6.
public:
7.
Test();
8.
~Test();
9.
type Data(type);
10.
};
11.
template
12.
type Test::Data(type Var0)
13.
{
14.
return Var0;
15.
}
16.
template
17.
Test::Test()
18.
{
19.
}
20.
template
21.
Test::~Test()
22.
{
23.
}
24.
int main(void)
25.
{
26.
Test Var3;
27.
cout
Answer: Option A. -> k
In this program, We are passing the values and printing it by using template inheritance.
Output:
$ g++ dert3.cpp
$ a.out
k
Answer: Option B. -> 200
In this program, We are passing the values and manipulating it by using the template inheritance.
Output:
$ g++ dert2.cpp
$ a.out
200