Top 100+ Most Asked C++ Interview Questions
A comprehensive guide to C++ interview questions covering core syntax, object-oriented programming, and memory management. Essential for developers preparing for technical rounds.
0%
Overall Progress
0/130
Status
Problem
Level
2.What are the main features of C++?Easy
2.What are the main features of C++?
Easy
3.What is the difference between struct and class in C++?Easy
3.What is the difference between struct and class in C++?
Easy
4.What are access specifiers in C++?Easy
4.What are access specifiers in C++?
Easy
5.What is encapsulation?Medium
5.What is encapsulation?
Medium
6.What is abstraction?Medium
6.What is abstraction?
Medium
7.What is inheritance?Medium
7.What is inheritance?
Medium
8.What is polymorphism?Medium
8.What is polymorphism?
Medium
9.What are the different types of inheritance in C++?Medium
9.What are the different types of inheritance in C++?
Medium
10.What is the difference between public, private, and protected inheritance?Hard
10.What is the difference between public, private, and protected inheritance?
Hard
11.What is a constructor? What are its types?Easy
11.What is a constructor? What are its types?
Easy
12.What is a destructor?Easy
12.What is a destructor?
Easy
13.What is the difference between constructor and destructor?Easy
13.What is the difference between constructor and destructor?
Easy
14.Can we have a virtual constructor?Hard
14.Can we have a virtual constructor?
Hard
15.Can we have a virtual destructor?Medium
15.Can we have a virtual destructor?
Medium
16.What is a copy constructor?Medium
16.What is a copy constructor?
Medium
17.What is a default constructor?Easy
17.What is a default constructor?
Easy
18.What is the difference between shallow copy and deep copy?Hard
18.What is the difference between shallow copy and deep copy?
Hard
19.What is operator overloading?Medium
19.What is operator overloading?
Medium
20.What is function overloading?Easy
20.What is function overloading?
Easy
21.What is function overriding?Medium
21.What is function overriding?
Medium
22.What is the difference between overloading and overriding?Medium
22.What is the difference between overloading and overriding?
Medium
23.What are virtual functions?Medium
23.What are virtual functions?
Medium
24.What is a pure virtual function?Medium
24.What is a pure virtual function?
Medium
25.What is an abstract class?Medium
25.What is an abstract class?
Medium
26.What is an interface in C++?Medium
26.What is an interface in C++?
Medium
27.What is the difference between abstract class and interface?Hard
27.What is the difference between abstract class and interface?
Hard
28.What is early binding and late binding?Medium
28.What is early binding and late binding?
Medium
29.What is dynamic binding?Hard
29.What is dynamic binding?
Hard
30.What is static binding?Medium
30.What is static binding?
Medium
31.What is the diamond problem in C++?Hard
31.What is the diamond problem in C++?
Hard
32.How do you resolve the diamond problem?Hard
32.How do you resolve the diamond problem?
Hard
33.What is virtual inheritance?Hard
33.What is virtual inheritance?
Hard
34.What are friend functions?Medium
34.What are friend functions?
Medium
35.What are friend classes?Medium
35.What are friend classes?
Medium
36.What is the 'this' pointer?Easy
36.What is the 'this' pointer?
Easy
37.Can we delete 'this' pointer?Hard
37.Can we delete 'this' pointer?
Hard
38.What is a static member variable?Medium
38.What is a static member variable?
Medium
39.What is a static member function?Medium
39.What is a static member function?
Medium
40.Can static functions access non-static members?Medium
40.Can static functions access non-static members?
Medium
41.What is the difference between new and malloc?Medium
41.What is the difference between new and malloc?
Medium
42.What is the difference between delete and free?Medium
42.What is the difference between delete and free?
Medium
43.What is a memory leak?Easy
43.What is a memory leak?
Easy
44.How do you prevent memory leaks?Medium
44.How do you prevent memory leaks?
Medium
45.What are smart pointers in C++?Medium
45.What are smart pointers in C++?
Medium
46.What is unique_ptr?Medium
46.What is unique_ptr?
Medium
47.What is shared_ptr?Medium
47.What is shared_ptr?
Medium
48.What is weak_ptr?Hard
48.What is weak_ptr?
Hard
49.What is the difference between stack and heap memory?Medium
49.What is the difference between stack and heap memory?
Medium
50.What is dynamic memory allocation?Easy
50.What is dynamic memory allocation?
Easy
51.What is RAII (Resource Acquisition Is Initialization)?Hard
51.What is RAII (Resource Acquisition Is Initialization)?
Hard
52.What is the difference between delete and delete[]?Medium
52.What is the difference between delete and delete[]?
Medium
53.What happens if you use delete instead of delete[] for arrays?Hard
53.What happens if you use delete instead of delete[] for arrays?
Hard
54.What is a dangling pointer?Medium
54.What is a dangling pointer?
Medium
55.What is a void pointer?Medium
55.What is a void pointer?
Medium
56.What is a null pointer?Easy
56.What is a null pointer?
Easy
57.What is nullptr in C++11?Medium
57.What is nullptr in C++11?
Medium
58.What is the difference between NULL and nullptr?Hard
58.What is the difference between NULL and nullptr?
Hard
59.What are the memory segments in C++?Hard
59.What are the memory segments in C++?
Hard
60.What is placement new?Hard
60.What is placement new?
Hard
61.What is the difference between pointer and reference?Easy
61.What is the difference between pointer and reference?
Easy
62.Can we have a null reference?Medium
62.Can we have a null reference?
Medium
63.Can we change what a reference refers to after initialization?Medium
63.Can we change what a reference refers to after initialization?
Medium
64.What is a pointer to pointer?Medium
64.What is a pointer to pointer?
Medium
65.What is a reference to pointer?Hard
65.What is a reference to pointer?
Hard
66.What are function pointers?Medium
66.What are function pointers?
Medium
67.What is the size of a pointer?Easy
67.What is the size of a pointer?
Easy
68.What is pointer arithmetic?Medium
68.What is pointer arithmetic?
Medium
69.What is a const pointer?Medium
69.What is a const pointer?
Medium
70.What is a pointer to const?Medium
70.What is a pointer to const?
Medium
71.What is const reference?Easy
71.What is const reference?
Easy
72.What is the difference between pass by value, pass by reference, and pass by pointer?Medium
72.What is the difference between pass by value, pass by reference, and pass by pointer?
Medium
73.What is a wild pointer?Easy
73.What is a wild pointer?
Easy
74.What is address of operator (&)?Easy
74.What is address of operator (&)?
Easy
75.What is dereference operator (*)?Easy
75.What is dereference operator (*)?
Easy
76.What are templates in C++?Medium
76.What are templates in C++?
Medium
77.What is function template?Medium
77.What is function template?
Medium
78.What is class template?Medium
78.What is class template?
Medium
79.What is template specialization?Hard
79.What is template specialization?
Hard
80.What is the difference between template and macro?Hard
80.What is the difference between template and macro?
Hard
81.What is STL?Easy
81.What is STL?
Easy
82.What are the main components of STL?Medium
82.What are the main components of STL?
Medium
83.What are containers in STL?Easy
83.What are containers in STL?
Easy
84.What are iterators in STL?Medium
84.What are iterators in STL?
Medium
85.What are algorithms in STL?Easy
85.What are algorithms in STL?
Easy
86.What is the difference between vector and array?Easy
86.What is the difference between vector and array?
Easy
87.What is the difference between vector and list?Medium
87.What is the difference between vector and list?
Medium
88.What is the difference between map and unordered_map?Hard
88.What is the difference between map and unordered_map?
Hard
89.What is the difference between set and multiset?Medium
89.What is the difference between set and multiset?
Medium
90.What is the time complexity of vector insertion?Medium
90.What is the time complexity of vector insertion?
Medium
91.What is the time complexity of map search?Medium
91.What is the time complexity of map search?
Medium
92.What are sequence containers?Easy
92.What are sequence containers?
Easy
93.What are associative containers?Medium
93.What are associative containers?
Medium
94.What are container adapters?Medium
94.What are container adapters?
Medium
95.What is an iterator invalidation?Hard
95.What is an iterator invalidation?
Hard
96.What is exception handling in C++?Easy
96.What is exception handling in C++?
Easy
97.What are the keywords used for exception handling?Easy
97.What are the keywords used for exception handling?
Easy
98.What is the difference between throw and throws?Hard
98.What is the difference between throw and throws?
Hard
99.What is stack unwinding?Hard
99.What is stack unwinding?
Hard
100.What is a namespace?Easy
100.What is a namespace?
Easy
101.What is the std namespace?Easy
101.What is the std namespace?
Easy
102.What is the using directive?Easy
102.What is the using directive?
Easy
103.What are inline functions?Medium
103.What are inline functions?
Medium
104.What is the difference between inline and macro?Medium
104.What is the difference between inline and macro?
Medium
105.What is a lambda expression in C++11?Medium
105.What is a lambda expression in C++11?
Medium
106.What is auto keyword in C++11?Easy
106.What is auto keyword in C++11?
Easy
107.What is decltype?Hard
107.What is decltype?
Hard
108.What is move semantics in C++11?Hard
108.What is move semantics in C++11?
Hard
109.What is an rvalue reference?Hard
109.What is an rvalue reference?
Hard
110.What is perfect forwarding?Hard
110.What is perfect forwarding?
Hard
111.What are variadic templates?Hard
111.What are variadic templates?
Hard
112.What is constexpr?Medium
112.What is constexpr?
Medium
113.What is the explicit keyword?Medium
113.What is the explicit keyword?
Medium
114.What is the mutable keyword?Hard
114.What is the mutable keyword?
Hard
115.What is the volatile keyword?Hard
115.What is the volatile keyword?
Hard
116.What is the difference between const and constexpr?Medium
116.What is the difference between const and constexpr?
Medium
117.What are static libraries and dynamic libraries?Medium
117.What are static libraries and dynamic libraries?
Medium
118.What is name mangling?Hard
118.What is name mangling?
Hard
119.What is extern "C"?Hard
119.What is extern "C"?
Hard
120.What is multiple inheritance?Medium
120.What is multiple inheritance?
Medium
121.What is the Rule of Three/Five/Zero?Hard
121.What is the Rule of Three/Five/Zero?
Hard
122.What is copy elision?Hard
122.What is copy elision?
Hard
123.What is Return Value Optimization (RVO)?Hard
123.What is Return Value Optimization (RVO)?
Hard
124.What are the differences between C++98, C++11, C++14, C++17, and C++20?Medium
124.What are the differences between C++98, C++11, C++14, C++17, and C++20?
Medium
125.What is thread safety?Medium
125.What is thread safety?
Medium
126.What are mutex and locks?Medium
126.What are mutex and locks?
Medium
127.What is the difference between struct and union?Easy
127.What is the difference between struct and union?
Easy
128.What is the sizeof operator?Easy
128.What is the sizeof operator?
Easy
129.What is type casting in C++? What are its types?Medium
129.What is type casting in C++? What are its types?
Medium
130.What is the difference between static_cast and dynamic_cast?Hard
130.What is the difference between static_cast and dynamic_cast?
Hard