Preparing for C++ interviews or tests? This Top 70 C++ MCQs collection is your ultimate resource. It includes frequently asked multiple-choice questions, categorized by topic, to help you revise core concepts, sharpen problem-solving skills, and evaluate your readiness.
Note: Score 60% or higher to unlock an exclusive offer of up to 50% off on all self-paced C++ courses.
Let's begin!
1. Which file extension is standard for a C++ source file?
2. Which keyword is used to define a constant value in C++?
3. Which header is required to use std::cout?
4. What is the correct signature for the program entry point in standard hosted C++?
5. Which operator is used to access a member through a pointer to an object?
6. What does the 'using namespace std;' statement do?
7. Which of these is a valid C++ single-line comment?
8. What will the expression (5 / 2) evaluate to in C++ when both operands are ints?
9. Which header provides std::string?
10. Which of the following defines a character literal?
11. What keyword is used to exit a loop immediately?
12. What does the 'inline' keyword request from the compiler?
13. Which of these function signatures is an overload of void f(int)?
14. What is the return type of main when using the signature int main()?
15. Which statement about default function arguments in C++ is true?
16. What does 'constexpr' indicate about a function or variable?
17. Which control flow statement skips the rest of loop body and goes to next iteration?
18. Which of these is a valid way to pass an argument by reference?
19. Which of the following allows a function to accept a variable number of arguments (C-style)?
20. What does 'overloading' refer to in C++?
21. Which keyword declares inheritance as public in class B from class A?
22. Which C++ feature allows runtime polymorphism?
23. Which of these is true about a pure virtual function?
24. What does the 'this' pointer represent inside a class method?
25. What is encapsulation in OOP?
26. Which keyword prevents a member function from being overridden in derived classes?
27. What is multiple inheritance?
28. Which member access specifier allows access only within the class and its friends?
29. Which special member function is called when an object is destroyed?
30. Which of these statements about copy constructor is true?
31. What does the 'new' operator do?
32. Which operator gives the address of a variable?
33. Which of these can cause a memory leak?
34. Which smart pointer should be used for sole ownership semantics?
35. What is a dangling pointer?
36. Which cast is the safest for downcasting in class hierarchies with virtual functions?
37. What value does a freshly default-initialized built-in pointer hold?
38. Which operator is used to deallocate memory allocated with new?
39. Which should you use to deallocate an array allocated with new[]?
40. What is RAII?
41. Which container provides fast random access and contiguous storage?
42. Which header is required to use std::vector?
43. What is the complexity of accessing an element by index in std::vector?
44. Which associative container stores unique keys in sorted order?
45. What does std::map::find return if a key is not present?
46. Which algorithm header contains std::sort?
47. Which iterator type allows modification of the pointed-to element?
48. Which container provides O(1) average-time lookup by key?
49. Which function inserts element at the end of std::vector?
50. Which STL component provides function wrappers and binders?
51. What is a function template?
52. How are template parameters specified when calling a function template explicitly?
53. What does 'typename' or 'class' keyword mean in a template parameter list?
54. Which C++ feature enables templates that accept a variable number of template parameters?
55. What is SFINAE commonly used for?
56. Which header provides type traits like std::is_integral?
57. Which C++11 feature simplifies initialization of containers with a list of values?
58. What does the 'auto' keyword do in C++11 onward?
59. Which construct introduces anonymous function objects?
60. What does 'nullptr' represent (introduced in C++11)?
61. Which tool stage converts source code (.cpp) into object files (.o)?
62. What role does the linker play?
63. What preprocessor directive prevents double inclusion of a header file?
64. Which flag compilers commonly use to enable all warnings (GCC/Clang)?
65. What is name mangling?
66. How are exceptions thrown and caught in C++?
67. Which header and type are commonly used for threading in modern C++?
68. What does 'const' applied to a member function indicate?
69. Which practice helps avoid data races when using multiple threads?
70. Which of the following is a recommended best practice in modern C++?
You Can Also Check:
1. 20 Best Programming Languages To Learn
2. What Is Software Engineer
3. Top PHP Interview Questions and answers
4. Java Tutorial for Beginners
Claude Fable 5 and Mythos 5: Anthropic's Most Powerful AI Model
June 11th, 2026