C ++ Programming Test

C++ Programming Test

Free C++ Programming Mock Test: Placement

Practice the free Online C++ Programming Test to get success in future placement. This online mock test will help you in the time of final placements.

General Instructions:
1. Each C ++ Programming test contains 15 questions.
2. Total allotted time is 20 minutes for each test.
3. No negative marking.
4. Try to finish it on time.
5. The Test will be submitted automatically if the time expired.
6. Don’t refresh the page.

0%

C ++ Programming Test 1

1 / 15

Which of the following statement is correct?

2 / 15

Which of the following statement is correct?

3 / 15

Which of the following is not a type of inheritance?

4 / 15

The value 132.54 can represented using which data type?

5 / 15

What is meant by template parameter?

6 / 15

Which is used to do the dereferencing?

7 / 15

Which of the following gives the memory address of the first element in array?

8 / 15

Which of the following type of class allows only one object of it to be created?

9 / 15

Which of the following statement is correct?

10 / 15

Which of the following correctly declares an array?        

11 / 15

What will be the output of the following program?

#include

class AreaFinder

{

float l, b, h;

float result;

public:

AreaFinder(float hh = 0, float ll = 0, float bb = 0)

{

l = ll;

b = bb;

h = hh;

}

void Display(int ll)

{

if(l = 0)

result = 3.14f * h * h;

else

result = l * b;

cout<< result; } }; int main()

{

AreaFinder objAF(10, 10, 20);

objAF.Display(0);

return 0;

}

12 / 15

Which of the following statements is correct?

  1. We can return a global variable by reference.
  2. We cannot return a local variable by reference.

13 / 15

Why reference is not same as a pointer?

14 / 15

What is the value of the literal 101?

15 / 15

What is the output of this program?


#include

using namespace std;

int main()

{

int a = 5, b = 10, c = 15;

int arr[3] = {&a, &b, &c};

cout << *arr[*arr[1] – 8]; return 0;

}


 

Your score is

The average score is 47%

0%

0%

C ++ Programming Test 2

1 / 15

How many objects can be created from an abstract class?

2 / 15

Which of the following correctly declares an array?

3 / 15

Which of the following statement is correct?

4 / 15

Which of the following is correct about function overloading?

5 / 15

Which operator is used to declare the destructor?

6 / 15

For automatic objects, constructors and destructors are called each time the objects

7 / 15

Which of the following implicitly creates a default constructor when the programmer does not explicitly define at least one constructor for a class?

8 / 15

Which of the following provides a reuse mechanism?

9 / 15

What is the output of the following?


#include

using namespace std;

int main()

{

char ch = ‘c’

cout << (int(c) + 1);

return 0;

}


 

10 / 15

Which of the following gives the memory address of the first element in array?

11 / 15

Which of the following is not a type of constructor?

12 / 15

Which of the following statement is correct?

13 / 15

What will be the output of the following program?

#include

int BixFunction(int a, int b = 3, int c = 3)

{

cout<< ++a * ++b * --c ; return 0;

}

int main()

{

BixFunction(5, 0, 0);

return 0;

}

14 / 15

Which of the following correctly describes overloading of functions?

15 / 15

What is the validity of template parameters?

Your score is

The average score is 50%

0%

0%

C ++ Programming Test 3

1 / 15

Which of the following statements is correct in C++?

2 / 15

Which of the following approach is adapted by C++?

3 / 15

Which of the following statement is correct?

4 / 15

What are the values of a and b?

int a = false

bool b = 99

5 / 15

What features make C++ so powerful?

6 / 15

Which of the following statement is correct about the program given below?

#include

int main()

{

int x = 80;

int y& = x;

x++;

cout << x << " " << --y; return 0;

}

7 / 15

Which of the following statement is correct about the references?

8 / 15

Which of the following statements is correct?

1.     Once the variable and the reference are linked they are tied together.

2.     Once the reference of a variable is declared another reference of that variable is not allowed.

9 / 15

Which of the following operator is overloaded for object cout ?

10 / 15

What are the things that are inherited from the base class?

11 / 15

Which of the following statements are correct?

12 / 15

What is correct about the following program?


#include

class Base

{

  int x, y, z;

public:

Base()

{

x = y = z = 0;

}

Base(int xx, int yy = ‘A’, int zz = ‘B’)

{

x = xx;

y = x + yy;

z = x + y;

}

void Display(void)

{

cout<< x << ” “ << y << ” “ << z << endl; } }; class Derived : public Base

{

int x, y;

public:

Derived(int xx = 65, int yy = 66) : Base(xx, yy)

{

y = xx;

x = yy;

}

void Display(void)

{

cout<< x << ” “ << y << ” “;

Display();

}

};

int main()

{

Derived objD;

objD.Display();

return 0;

}


 

13 / 15

Which of the following literal integer constants are hexadecimal?

14 / 15

A __________ is a special method used to initialize the instance variable of a class.

15 / 15

What happens when a class with parameterized constructors and having no default constructor is used in a program and we create an object that needs a zero-argument constructor?

Your score is

The average score is 41%

0%

0%

C ++ Programming Test 4

1 / 15

It is a __________ error to pass arguments to a destructor.

2 / 15

Which of the following statement will be correct if the function has three arguments passed to it?

3 / 15

Which of the following statement is correct?

4 / 15

Which rule will not affect the friend function?

5 / 15

What is the output of this program?


#include

#include

using namespace std;

int main ()

{

string str (“steve jobs is legend”);

string::iterator it;

str.erase (str.begin()+ 5, str.end()-7);

cout << str << endl; return 0; }


 

6 / 15

Which of the following factors supports the statement that reusability is a desirable feature of a language?

7 / 15

What will be the output of the following program?

#include

class BixBase

{

public:

BixBase()

{

cout<< "Base OK. “;

}

~BixBase()

{

cout<< “Base DEL. “;

}

};

class BixDerived: public BixBase

{

public:

BixDerived()

{

cout<< “Derived OK. “;

}

~BixDerived()

{

cout<< “Derived DEL. “;

}

};

int main()

{

BixBase *basePtr = new BixDerived();

  delete basePtr;

return 0;

}

8 / 15

Which of the following statement is correct?

9 / 15

Which of the following statements is correct?

10 / 15

Which of the following is user defined data type?

11 / 15

What happens if the base and derived class contains definition of a function with same prototype?

12 / 15

Which of the following is a mechanism of static polymorphism?

13 / 15

Which of the following statements is correct?

14 / 15

Which concept uses the preincrement?

15 / 15

What is the output of this program?


#include

#include

using namespace std;

int main()

{

complex i(2, 3);

i = i * 6 / 3;

cout << i; return 0; }


 

Your score is

The average score is 39%

0%

0%

C ++ Programming Test 5

1 / 15

What is the output of this program?


#include

#include

using namespace std;

int main()

{

complex i(2, 3);

i = i * 6 / 3;

cout << i; return 0; }


 

2 / 15

Which of the following gets called when an object is being created?

3 / 15

It is a __________ error to pass arguments to a destructor.

4 / 15

Which of the following also known as an instance of a class?

5 / 15

Which of the following is not a type of constructor?

6 / 15

What does the dereference operator will return?

7 / 15

Which of the following statement is correct?

8 / 15

When are the Global objects destroyed?

9 / 15

Destructor has the same name as the constructor and it is preceded by ______ .

10 / 15

Everything defined at the program scope level (ie. outside functions and classes) is said to be ……………

11 / 15

Which of the following operator can’t be overloaded?

12 / 15

Can a class have virtual destructor?

13 / 15

Which of the following statement is correct about destructors?

14 / 15

Which of the following gets called when an object goes out of scope?

15 / 15

cout is a/an __________ .?

Your score is

The average score is 52%

0%