C++ MCQ Test: C++ MCQs - Practice Questions
1. Which data type is used to store characters in C++?
2. How do you declare a variable in C++?
3. How is polymorphism achieved in C++?
4. What is the purpose of the 'inline' keyword in C++?
5. What is the difference between '++i' and 'i++' in C++?
6. What is the role of the 'std::thread' class in C++?
7. How do you create a multi-line comment in C++?
8. Which type of loop is controlled by a condition at the end?
9. What is a lambda expression in C++?
10. What is the purpose of the 'namespace' keyword in C++?
11. What is the purpose of 'void' in a function declaration in C++?
12. What is the purpose of the 'virtual' keyword in C++?
13. What is the 'auto' keyword used for in C++?
14. What is the purpose of 'namespace' in C++?
15. How do you include the header file 'cmath' in C++?
16. What is the purpose of the 'const' keyword in C++?
17. In C++, how do you swap the values of two variables without using a third variable?
18. What is the role of the 'friend' keyword in C++?
19. Explain the concept of smart pointers in C++.
20. How is function overloading implemented in C++?
21. What is the difference between 'delete' and 'delete[]' in C++?
22. How is operator overloading implemented in C++?
23. What is the value of 'true' in C++?
24. What is the syntax for a single-line comment in C++?
25. How does exception handling work in C++?
26. What is a destructor in C++?
27. What is a smart pointer in C++?
28. What is the purpose of 'cout' in C++?
29. What is the role of the 'typeid' operator in C++?
30. What is the purpose of the 'auto' keyword in C++11?
31. What is the 'virtual' keyword used for in C++?
32. How do you implement multiple inheritance in C++?
33. In C++, what is the 'nullptr' keyword used for?
34. What is the purpose of the 'std::algorithm' header in C++?
35. What is a reference variable in C++?
36. What is the Rule of Three in C++?
37. Explain the use of 'std::move()' in C++.
38. How is memory allocated for a dynamic array in C++?
39. What is the difference between 'const' and 'constexpr' in C++?
40. How is dynamic memory allocated in C++?
41. What is a template in C++?
42. What is the purpose of the 'const_cast' operator in C++?
43. How are header files used in C++?
44. What does the '>>' operator do in C++?
45. How is a copy constructor different from an assignment operator in C++?
46. Explain the difference between 'stack' and 'heap' in C++ memory management.
47. What is the purpose of 'friend' functions in C++?
48. What is the 'cin' object used for in C++?
49. In C++, how do you initialize an array of integers with values 1, 2, and 3?
50. What is the 'nullptr' keyword used for in C++?