Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

C++ interviews concentrate on resource management and the costs of each abstraction. Expect questions on RAII and smart pointers, move semantics and why move operations should be noexcept, the Rule of Three, Five and Zero, virtual destructors, STL container trade-offs and iterator invalidation, and the difference between compile-time and runtime polymorphism. Undefined behaviour and the sanitizers used to find it come up regularly. The questions below cover modern C++ practice rather than legacy patterns.

C++ MCQ

1.What does RAII stand for and what does it guarantee?

2.Which smart pointer represents exclusive ownership with no runtime overhead?

3.What problem does std::weak_ptr solve?

4.What does std::move actually do?

5.Why should move constructors be marked noexcept?

6.What is the Rule of Zero?

7.Why must a base class intended for polymorphic deletion have a virtual destructor?

8.What is the difference between a reference and a pointer in C++?

9.Which STL container should be the default choice for a sequence of elements?

10.What is the average lookup complexity of std::unordered_map?

11.What happens to iterators when a std::vector reallocates during push_back?

13.What does the const qualifier on a member function declare?

14.What is the difference between compile-time and runtime polymorphism?

15.Where does a std::vector store its elements?

16.Which tool detects use-after-free and out-of-bounds memory access at runtime?

17.What constitutes a data race in C++?

18.Which RAII wrapper should be used to lock a std::mutex?

19.What must be done with a std::thread before its destructor runs?

20.What is the purpose of std::optional?

21.What does std::string_view provide?

22.Which loop form avoids copying elements when iterating a container of large objects?

23.What does the explicit keyword on a single-argument constructor prevent?

24.What is undefined behaviour in C++?

25.Which container guarantees elements are stored in sorted key order?

26.What does the emplace_back member function do that push_back does not?

27.What is the difference between stack and heap allocation?

28.Which error results from unbounded recursion?

29.What does constexpr indicate?

30.Reading right to left, what does const char* const p declare?

31.What problem does virtual inheritance solve?

32.Which standard library algorithm removes elements matching a predicate from a container?

33.What is a dangling reference?

34.What is the purpose of std::make_unique?

35.What does a lambda capture clause written as [&] mean?

36.Why must templates usually be defined in header files?

37.What do C++20 concepts improve?

38.Which statement about std::shared_ptr's reference count is correct?

39.What does the noexcept specifier tell the compiler?

40.Which is the most reliable way to find a memory leak in a C++ program?

41.What does structured binding in C++17 allow?

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as