C++ MCQ Test: C++ MCQs - Practice Questions
1. How is exception handling done in C++?
2. What does the 'this' pointer refer to in C++?
3. What is the syntax for a single-line comment in C++?
4. How do you implement multiple inheritance in C++?
5. What is the purpose of the 'explicit' keyword in C++?
6. What is the RAII (Resource Acquisition Is Initialization) principle in C++?
7. What is the 'break' statement used for in C++?
8. How is a copy constructor different from an assignment operator in C++?
9. What does the 'sizeof' operator return in C++?
10. How does exception handling work in C++?
11. What is the purpose of 'cout' in C++?
12. What is the role of the 'volatile' keyword in C++?
13. What is the purpose of the 'std::algorithm' header in C++?
14. What is the purpose of the 'namespace' keyword in C++?
15. What is the role of the 'friend' keyword in C++?
16. What is a pure virtual function in C++?
17. What is a lambda expression in C++?
18. Which header file is used for input and output functions in C++?
19. How is dynamic memory allocated in C++?
20. Which type of loop is controlled by a condition at the end?
21. How do you create a multi-line comment in C++?
22. How is operator overloading implemented in C++?
23. Explain the difference between pass by value and pass by reference in C++.
24. What is the difference between 'override' and 'final' in C++?
25. How do you declare a constant in C++?
26. What is the purpose of the 'const' keyword in C++?
27. Explain the concept of move semantics in C++.
28. Explain the concept of template specialization in C++.
29. What is the purpose of the 'typeid' operator in C++?
30. In C++, how do you initialize an array of integers with values 1, 2, and 3?
31. What is the purpose of the 'inline' keyword in C++?
32. Explain the purpose of the 'mutable' keyword in C++.
33. What is the purpose of the 'const_cast' operator in C++?
34. Explain the difference between 'stack' and 'heap' in C++ memory management.
35. What is a smart pointer in C++?
36. What is the 'nullptr' keyword used for in C++?
37. Explain the concept of smart pointers in C++.
38. How do you declare a variable in C++?
39. What is the difference between 'const' and 'constexpr' in C++?
40. What is the main function's return type in C++?