25 questions on Programming Practices (C++) along with answers:
What is the main difference between C and C++?
Explain encapsulation in C++.
What is inheritance in C++?
What is polymorphism in C++?
Define constructor and destructor in C++.
What is operator overloading?
Explain what a virtual function is in C++.
What is a pure virtual function?
= 0, making the class abstract.Explain the concept of namespaces in C++.
What is the this pointer?
this is a pointer to the current object instance, used within class methods.Define function overloading.
What is the purpose of friend keyword in C++?
friend allows a function or another class to access private members of a class.Explain the static keyword in C++.
static variables retain their value between function calls and are shared by all instances of a class.What is an exception in C++?
try, catch, and throw.Define the concept of dynamic memory allocation in C++.
new and deallocated with delete.What are templates in C++?
What is the difference between struct and class in C++?
struct members are public, while class members are private.Explain what a copy constructor is.
What is a function pointer?
Explain the role of the const keyword.
const defines constants, preventing variables from being modified after initialization.What are standard template library (STL) containers?
vector, list, map, and set store collections of data.What is the difference between ++i and i++?
++i increments i before returning it; i++ increments after returning the original i.Explain type casting in C++.
static_cast, dynamic_cast, const_cast, and reinterpret_cast.What is a lambda function in C++?
[] for use in-line.What is the purpose of a move constructor?
Let me know if you need more in-depth explanations or examples for any of these!
0 Comments