Get Free Job Alerts on your Mobile by SMS- Subscribe now
If you would like to view All C++ language interview questions only, at one place, visit below link
21 What is the difference between a NULL pointer and a void pointer?
Ans: 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).
22. What is difference between C++ and Java?
Ans: C++ has pointers Java does not.
Java is platform independent C++ is not.
Java has garbage collection C++ does not.
23. What do you mean by multiple inheritance in C++ ?
Ans: 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.
24. What do you mean by virtual methods?
Ans: 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.
25. What do you mean by static methods?
Ans: 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.
26. How many ways are there to initialize an int with a constant?
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);
27. What is a constructor?
Ans: 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.
28. What is destructor?
Ans: Destructor is a special member function of a class, which is invoked automatically whenever an object goes out of the scope. It has the same name as its class with a tilde character prefixed.
29. What is an explicit constructor?
Ans: A conversion constructor declared with the explicit keyword. The compiler does not use an explicit constructor to implement an implied conversion of types. It’s purpose is reserved explicitly for construction.
30 What is the Standard Template Library?
Ans: A library of container templates approved by the ANSI committee for inclusion in the standard C++ specification. A programmer who then launches into a discussion of the generic programming model, iterators, allocators, algorithms, and such, has a higher than average understanding of the new technology that STL brings to C++ programming.
Related Fresher Interview Questions
1. C Language Interview Questions
2. C++ Language Interview Questions
3. Data Structures Interview Questions
4. DBMS Interview Questions
5. Operating System Interview Questions
6. UNIX Interview Questions
Tags:aptitude question on c++, basic c++ interview questions, basic c++ interview questions and answers, basic c++ interview questions answers, c and c++ interview questions for freshers, c interview questions, c interview questions and answers, c interview questions and answers for freshers, c interview questions for freshers, c++ interview questions answers, c++ interview questions for experienced, cpp interview questions, cpp interview questions and answers, fresher interview questions, fresher interview questions and answers, fresher interview questions and answers on c and c++, fresher interview questions on c and c++, fresher interview questions with answers, interview question on c++, it fresher interview questions, it fresher interview questions and answers, objective question on c++, objective type question on c++, question on c++, questions for interview, technical question on c++, viva question on c++