C plus plus Interview Questions & Answers

Showing 10 of 92 questions | Page 7

Technical interview questions and answers play a major role in C++ Interviews because C++ is widely used in system programming, game development, competitive coding, and performance-critical applications. Companies expect candidates to know OOP concepts, classes, inheritance, polymorphism, references, memory management, STL, and exception handling. These questions often appear in campus placements and software interviews conducted by TCS, Wipro, Infosys, Cognizant, and Capgemini. This guide covers frequently asked C++ interview questions with simple explanations that help freshers and job seekers strengthen their programming foundation. Preparing these questions will help you perform well in coding tests, technical rounds, and real-time problem-solving interviews.

Showing 10 of 92 questions

61. What do you mean by implicit conversion?

Whenever data types are mixed in an expression then c++ performs the conversion automatically. Here smaller type is converted to wider type. Example- in case of integer and float integer is converted into float type.

62. What is the difference between method overloading and method overriding?

Overloading a method (or function) in C++ is the ability for functions of the same name to be defined as long as these methods have different signatures (different set of parameters). Method overriding is the ability of the inherited class rewriting the virtual method of the base class.

63. What is polymorphism?

Polymorphism is the idea that a base class can be inherited by several classes. A base class pointer can point to its child class and a base class array can store different child class objects.

64. What do you mean by inline function?

An inline function is a function that is expanded inline when invoked.ie. the compiler replaces the function call with the corresponding function code. An inline function is a function that is expanded in line when it is invoked. That is the compiler replaces the function call with the corresponding function code (similar to macro).

65. What is the difference between a NULL pointer and a void pointer?

A NULL pointer is a pointer of any type whose value is zero. A void pointer is a pointer to an object of an unknown type, and is guaranteed to have enough bits to hold a pointer to any object. A void pointer is not guaranteed to have enough bits to point to a function (though in general practice it does).

66. What do you mean by multiple inheritance in C++ ?

Multiple inheritance is a feature in C++ by which one class can be of different types. Say class teaching Assistant is inherited from two classes say teacher and Student.

67. What do you mean by virtual methods?

virtual methods are used to use the polymorphism feature in C++. Say class A is inherited from class B. If we declare say function f() as virtual in class B and override the same function in class A then at runtime appropriate method of the class will be called depending upon the type of the object.

68. What do you mean by static methods?

By using the static method there is no need creating an object of that class to use that method. We can directly call that method on that class. For example, say class A has static function f(), then we can call f() function as A.f(). There is no need of creating an object of class A.

69. How many ways are there to initialize an int with a constant?

Two. There are two formats for initializers in C++ as shown in the example that follows. The first format uses the traditional C notation. The second format uses constructor notation. int foo = 123; int bar (123);

70. What is a constructor?

Constructor is a special member function of a class, which is invoked automatically whenever an instance of the class is created. It has the same name as its class.
Questions and Answers for Competitive Exams Various Entrance Test