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. Use the TNP C++ Programming Mock test to assess your competence. You’ll pick up C++ faster and have more fun doing this. So, what are waiting for just click test.tnpofficer.com and dive into the world of C++.

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 type of class allows only one object of it to be created?

2 / 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;

}

3 / 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;

}


 

4 / 15

Which is used to do the dereferencing?

5 / 15

Which of the following is not a type of inheritance?

6 / 15

Why reference is not same as a pointer?

7 / 15

Which of the following correctly declares an array?        

8 / 15

The value 132.54 can represented using which data type?

9 / 15

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

10 / 15

Which of the following statement is correct?

11 / 15

What is the value of the literal 101?

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

Which of the following statement is correct?

14 / 15

What is meant by template parameter?

15 / 15

Which of the following statement is correct?

Your score is

The average score is 47%

0%

0%

C ++ Programming Test 2

1 / 15

Which of the following correctly declares an array?

2 / 15

What is the validity of template parameters?

3 / 15

Which of the following is not a type of constructor?

4 / 15

Which of the following statement is correct?

5 / 15

Which of the following is correct about function overloading?

6 / 15

What is the output of the following?


#include

using namespace std;

int main()

{

char ch = ‘c’

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

return 0;

}


 

7 / 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;

}

8 / 15

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

9 / 15

Which operator is used to declare the destructor?

10 / 15

How many objects can be created from an abstract class?

11 / 15

Which of the following correctly describes overloading of functions?

12 / 15

Which of the following statement is correct?

13 / 15

Which of the following provides a reuse mechanism?

14 / 15

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

15 / 15

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

Your score is

The average score is 50%

0%

0%

C ++ Programming Test 3

1 / 15

Which of the following operator is overloaded for object cout ?

2 / 15

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

3 / 15

Which of the following statements are correct?

4 / 15

What are the values of a and b?

int a = false

bool b = 99

5 / 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.

6 / 15

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

7 / 15

Which of the following statement is correct?

8 / 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;

}

9 / 15

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

10 / 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?

11 / 15

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

12 / 15

What features make C++ so powerful?

13 / 15

Which of the following statement is correct about the references?

14 / 15

Which of the following literal integer constants are hexadecimal?

15 / 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;
}

 

Your score is

The average score is 42%

0%

0%

C ++ Programming Test 4

1 / 15

Which of the following statement is correct?

2 / 15

Which of the following statements is correct?

3 / 15

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

4 / 15

Which of the following is user defined data type?

5 / 15

Which of the following is a mechanism of static polymorphism?

6 / 15

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

7 / 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; }

 

8 / 15

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

9 / 15

What will be the output of the following program?

#include

class BixBase

{

public:

BixBae()

{

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;

10 / 15

Which rule will not affect the friend function?

11 / 15

Which of the following statement is correct?

12 / 15

Which of the following statements is correct?

13 / 15

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

14 / 15

Which concept uses the preincrement?

15 / 15

What is the output of this program?

#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;

}

Your score is

The average score is 37%

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 is not a type of constructor?

3 / 15

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

4 / 15

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

5 / 15

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

6 / 15

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

7 / 15

When are the Global objects destroyed?

8 / 15

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

9 / 15

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

10 / 15

Which of the following statement is correct?

11 / 15

Which of the following statement is correct about destructors?

12 / 15

Which of the following operator can’t be overloaded?

13 / 15

cout is a/an __________ .?

14 / 15

What does the dereference operator will return?

15 / 15

Can a class have virtual destructor?

Your score is

The average score is 50%

0%

C++ Test Description

This exam assesses your level of competency in C++ programming, emphasizing grammar, problem-solving techniques, and fundamental language ideas. Important topics including data types, functions, classes, inheritance, polymorphism, control structures, and standard library usage will be covered in your test. The purpose of the questions is to evaluate your proficiency in object-oriented concepts, debugging and optimizing existing code, and writing reliable and efficient C++ code. This test is appropriate for applicants who have a basic understanding of C++ and is designed to determine your level of preparedness for practical software development jobs.

Expertise your following skills through mock test

  • Functions
  • Classes
  • Inheritance
  • Polymorphism
  • Data types
  • Variables
Frequently Asked Questions

C++ can be used in developing browsers, operating systems and applications as well as in game programming, software engineering, data structures etc.

C++ can be used in developing browsers, operating systems and applications as well as in game programming, software engineering, data structures etc.

While learning C++ start with C++ basics which includes comments, tokens, identifiers, structure of code then learn variables, data types, operators, functions, pointer, arrays & strings, structure & unions, object-oriented programming, encapsulation and abstraction, polymorphism, Inheritance.

Objects and classes are used to wrap related functions in data in one place in C ++. Is a blueprint for the object. A class in C++ is defined using the keyboard class followed by the name of the class. To use the data and access functions defined in the class, we create objects. For example: “class TNP”.

TNP Officer provides lots of mock tests to practice. You can find and practice a free C++ programming mock test at test.tnpofficer.com.