Sail E0 Webinar

MCQs

Total Questions : 5
Question 1.

How many kinds of parameters are there in C++?


  1.    1
  2.    2
  3.    3
  4.    None of the mentioned
 Discuss Question
Answer: Option C. -> 3

There are three kinds of parameters are there in C++. They are type, non-type, template.

Question 2.

How many kinds of entities are directly parameterized in c++?


  1.    1
  2.    2
  3.    3
  4.    4
 Discuss Question
Answer: Option C. -> 3

C++ allows us to parameterize directly three kinds of entities through templates: types, constants, 

and templates.


Question 3.


What is the output of this program?


1.
#include
2.
using namespace std;
3.
class Base
4.
{
5.
public:
6.
Base ( )
7.
{
8.
cout
  1.    1234
  2.    4321
  3.    1423
  4.    1342
 Discuss Question
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.


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
  1.    k
  2.    l
  3.    error
  4.    runtime error
 Discuss Question
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


Question 5.


What is the output of this program?


1..
#include
2.
using namespace std;
3.
template
4.
class A
5.
{
6.
public:
7.
A(int a): x(a) {}
8.
protected:
9.
int x;
10.
};
11.
template
12.
class B: public A
13.
{
14.
public:
15.
B(): A::A(100)
16.
{
17.
cout
  1.    100
  2.    200
  3.    error
  4.    runtime error
 Discuss Question
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


Latest Videos

Latest Test Papers