⚙️

C++ MCQ

Test your C++ knowledge with 100 multiple choice questions covering fundamentals to advanced concepts, with instant feedback and explanations.

100 Questions 40 Beginner 40 Intermediate 20 Advanced
1

What is the correct file extension for a C++ source file?

2

Which header file must be included to use cout in C++?

3

What does cout stand for?

4

What is the correct syntax to define a variable of type integer?

5

What is the entry point of a C++ program?

6

What does the :: operator represent in C++?

7

What is a pointer in C++?

8

What is the difference between & and * when declaring variables?

9

What is a reference in C++?

10

Which keyword allocates memory on the heap in C++?

11

What is function overloading in C++?

12

What keyword is used to define a class in C++?

13

What is the default access specifier for members of a class?

14

What is a destructor?

15

What does the virtual keyword do?

16

What is a pure virtual function?

17

What does the const keyword on a member function mean?

18

What is a template in C++?

19

What is the STL?

20

What is a vector in C++?

21

What does #include do?

22

What is the difference between stack and heap memory?

23

What is a namespace?

24

What does endl do?

25

What is the size of a bool in C++?

26

What is operator overloading?

27

What is a copy constructor?

28

What is the this pointer?

29

What is inheritance in C++?

30

What does the delete operator do?

31

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

32

What is a static member in C++?

33

What does the inline keyword suggest for a function?

34

What is the range-based for loop syntax in C++11?

35

What is a nullptr?

36

What does auto mean when declaring a variable in C++11?

37

What is the purpose of the const qualifier on a variable?

38

What is function call by reference?

39

What is a string in C++?

40

What is a memory leak?

1

What is RAII (Resource Acquisition Is Initialization)?

2

What is a smart pointer?

3

What is the difference between unique_ptr and shared_ptr?

4

What is a move constructor?

5

What are lvalue and rvalue in C++?

6

What is std::move?

7

What is template specialization?

8

What is the vtable?

9

What is the Rule of Five in C++11?

10

What is SFINAE?

11

What does std::enable_if do?

12

What is perfect forwarding?

13

What is a lambda expression in C++11?

14

What is constexpr?

15

What is std::optional?

16

What is structured bindings (C++17)?

17

What is a variadic template?

18

What is the purpose of weak_ptr?

19

What is undefined behavior in C++?

20

What does the noexcept specifier do?

21

What is copy elision?

22

What is the std::string_view (C++17)?

23

What is an initializer list (std::initializer_list)?

24

What does decltype do?

25

What is the difference between const int* and int* const?

26

What is SFINAE and how does std::void_t simplify it?

27

What is the std::span type?

28

What is the std::ranges library (C++20)?

29

What is the Pimpl (Pointer to Implementation) idiom?

30

What is fold expression in C++17?

31

What is if constexpr in C++17?

32

What is a designated initializer (C++20)?

33

What is the three-way comparison operator <=> (spaceship)?

34

What is std::expected (C++23)?

35

What is CRTP used for beyond static polymorphism?

36

What are C++20 concepts used for vs SFINAE in terms of readability?

37

What is coroutine_handle in C++20?

38

What is the co_yield expression in C++20?

39

What is std::jthread and how does it differ from std::thread?

40

What is exception safety in C++ and what are the three guarantees?