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

1.What is C++? How is it different from C?

2.What are the main features of C++?

3.What is the difference between struct and class in C++?

4.What are access specifiers in C++?

5.What is encapsulation?

6.What is abstraction?

7.What is inheritance?

8.What is polymorphism?

9.What are the different types of inheritance in C++?

10.What is the difference between public, private, and protected inheritance?

11.What is a constructor? What are its types?

12.What is a destructor?

13.What is the difference between constructor and destructor?

14.Can we have a virtual constructor?

15.Can we have a virtual destructor?

16.What is a copy constructor?

17.What is a default constructor?

18.What is the difference between shallow copy and deep copy?

19.What is operator overloading?

20.What is function overloading?

21.What is function overriding?

22.What is the difference between overloading and overriding?

23.What are virtual functions?

24.What is a pure virtual function?

25.What is an abstract class?

26.What is an interface in C++?

27.What is the difference between abstract class and interface?

28.What is early binding and late binding?

29.What is dynamic binding?

30.What is static binding?

31.What is the diamond problem in C++?

32.How do you resolve the diamond problem?

33.What is virtual inheritance?

34.What are friend functions?

35.What are friend classes?

36.What is the 'this' pointer?

37.Can we delete 'this' pointer?

38.What is a static member variable?

39.What is a static member function?

40.Can static functions access non-static members?

41.What is the difference between new and malloc?

42.What is the difference between delete and free?

43.What is a memory leak?

44.How do you prevent memory leaks?

45.What are smart pointers in C++?

46.What is unique_ptr?

47.What is shared_ptr?

48.What is weak_ptr?

49.What is the difference between stack and heap memory?

50.What is dynamic memory allocation?

51.What is RAII (Resource Acquisition Is Initialization)?

52.What is the difference between delete and delete[]?

53.What happens if you use delete instead of delete[] for arrays?

54.What is a dangling pointer?

55.What is a void pointer?

56.What is a null pointer?

57.What is nullptr in C++11?

58.What is the difference between NULL and nullptr?

59.What are the memory segments in C++?

60.What is placement new?

61.What is the difference between pointer and reference?

62.Can we have a null reference?

63.Can we change what a reference refers to after initialization?

64.What is a pointer to pointer?

65.What is a reference to pointer?

66.What are function pointers?

67.What is the size of a pointer?

68.What is pointer arithmetic?

69.What is a const pointer?

70.What is a pointer to const?

71.What is const reference?

72.What is the difference between pass by value, pass by reference, and pass by pointer?

73.What is a wild pointer?

74.What is address of operator (&)?

75.What is dereference operator (*)?

76.What are templates in C++?

77.What is function template?

78.What is class template?

79.What is template specialization?

80.What is the difference between template and macro?

81.What is STL?

82.What are the main components of STL?

83.What are containers in STL?

84.What are iterators in STL?

85.What are algorithms in STL?

86.What is the difference between vector and array?

87.What is the difference between vector and list?

88.What is the difference between map and unordered_map?

89.What is the difference between set and multiset?

90.What is the time complexity of vector insertion?

91.What is the time complexity of map search?

92.What are sequence containers?

93.What are associative containers?

94.What are container adapters?

95.What is an iterator invalidation?

96.What is exception handling in C++?

97.What are the keywords used for exception handling?

98.What is the difference between throw and throws?

99.What is stack unwinding?

100.What is a namespace?

101.What is the std namespace?

102.What is the using directive?

103.What are inline functions?

104.What is the difference between inline and macro?

105.What is a lambda expression in C++11?

106.What is auto keyword in C++11?

107.What is decltype?

108.What is move semantics in C++11?

109.What is an rvalue reference?

110.What is perfect forwarding?

111.What are variadic templates?

112.What is constexpr?

113.What is the explicit keyword?

114.What is the mutable keyword?

115.What is the volatile keyword?

116.What is the difference between const and constexpr?

117.What are static libraries and dynamic libraries?

118.What is name mangling?

119.What is extern "C"?

120.What is multiple inheritance?

121.What is the Rule of Three/Five/Zero?

122.What is copy elision?

123.What is Return Value Optimization (RVO)?

124.What are the differences between C++98, C++11, C++14, C++17, and C++20?

125.What is thread safety?

126.What are mutex and locks?

127.What is the difference between struct and union?

128.What is the sizeof operator?

129.What is type casting in C++? What are its types?

130.What is the difference between static_cast and dynamic_cast?