C++ Programming Interview Questions and Answers - 1
Question: 1
What is the difference between late binding and early binding?
Late binding refers to functions calls that are not resolved until run time while early binding refers to the events that occur at compile time.
Late binding occurs through virtual functions while early binding takes place when all the information needed to call a function is known at the time of compiling.
Early binding increases the efficiency. Some of the examples of early binding are normal function calls, overloaded function calls, and overloaded operators etc.
Question: 2
Define a constructor?
Constructor is a member functions of the class, with the name of the functions being the same as the class name. It also specifies how the object should be initialized.
Ways of calling constructor:
Implicitly: automatically by compiler when an object is created.
Calling the constructor explicitly is possible, but it makes the code unverifiable.
Question: 3
What is Standard Template Library (STL)?
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.
Question: 4
What are virtual functions?
A virtual function allows derived classes to replace the implementation provided by the base class.
The compiler make sure the replacement is always called whenever the object in question is actually of the derived class, even if the objects is accessed by a base pointer rather than a derived class, even if users don’t know about the derived class.
Question: 5
What is friend function?
As the name suggests, the function acts as a friend to a class.
As a friend of a class, it can access its private and protected members.
A friend function is not a member of the class. But it must be listed in the class definition.
- C++ Interview Questions and Answers for Experienced
- Top 200+ C++ Interview Questions and Answers
- C++ Interview Questions and Answers for Freshers
- Advanced C++ Programming Interview Questions and Answers
- C++ Language Interview Questions for Experienced Pdf
- C++ Programs Asked in Interview for Freshers
- C++ Interview Questions and Answers Pdf
- C++ Language Interview Questions and Answers for Freshers Pdf
- C++ Questions and Answers
- Top 250+ C++ Constructor and Destructor Programming Interview Questions
- C++ basic interview questions and answers pdf
- C++ Programming Interview Questions and Answers
- C++ Technical Interview Questions and Answers
- Top 200+ Advanced C++ Interview Questions 2020-2021
- C++ Lab Viva-Practical Exams Questions and Answers
- C++ Coding Interview Questions and Answers
TNPSC Migration and Urbanisation Research Questions More
Migration and Urbanisation MCQ Questions and Answers Pdf More
Migration and Urbanisation Class 8 Questions and Answers Pdf More
People's Revolt Class 8 Questions and Answers Pdf More
Trade and Territory Class 8 Questions and Answers Pdf More
PG TRB Geography Model Question Paper with Answer More
Computer Networks Quiz Questions and Answers Pdf More
Linux Multiple Choice Questions and Answers More
Top 151+ Computer Communication and Networking Quiz 2020-2021 More
PG TRB Home science Online Test More