1.
C++ Basics and Language Features
- 2.
Explain the difference between C and C++.
- 3.
What is object-oriented programming in C++?
- 4.
What are the access specifiers in C++ and what do they do?
- 5.
Explain the concept of namespaces in C++.
- 6.
What is the difference between ‘struct’ and ‘class’ in C++?
- 7.
What is a constructor and what are its types in C++?
- 8.
Explain the concept of destructors in C++.
- 9.
What is function overloading in C++?
- 10.
What is operator overloading in C++?
Memory Management and Pointers
- 11.
What is dynamic memory allocation in C++?
- 12.
Explain the difference between ‘new’ and ‘malloc()’.
- 13.
What is a memory and how can it be prevented?
- 14.
What is a dangling pointer?
- 15.
Explain the concept of smart pointers in C++.
- 16.
What is the difference between unique_ptr, shared_ptr, and weak_ptr?
- 17.
How does reference counting work in shared_ptr?
- 18.
What is the rule of three in C++?
- 19.
What is the rule of five in C++?
- 20.
Explain move semantics in C++.
Object-Oriented Programming Concepts
- 21.
What is inheritance in C++? Explain its types.
- 22.
What is polymorphism and how is it implemented in C++?
- 23.
Explain the concept of virtual functions in C++.
- 24.
What is a pure virtual function?
- 25.
What is an abstract class in C++?
- 26.
Explain the diamond problem in multiple inheritance and how to solve it.
- 27.
What is function hiding in C++?
- 28.
Explain the concept of friend functions and classes.
- 29.
What is the difference between composition and inheritance?
- 30.
What is RAII (Resource Acquisition Is Initialization) in C++?
Templates and Generic Programming
- 31.
What are templates in C++?
- 32.
Explain the difference between function templates and class templates.
- 33.
What is template specialization?
- 34.
How does template metaprogramming work in C++?
- 35.
What are variadic templates?
- 36.
Explain the concept of type traits in C++.
- 37.
What is SFINAE (Substitution Failure Is Not An Error)?
- 38.
How do you implement a type-safe container using templates?
- 39.
What are the advantages and disadvantages of using templates?
- 40.
Explain the concept of template argument deduction.
Exception Handling
- 41.
What is exception handling in C++?
- 42.
Explain the try, catch, and throw keywords.
- 43.
What is the purpose of the ‘noexcept’ specifier?
- 44.
How do you create custom exception classes?
- 45.
What happens if an exception is not caught?
- 46.
Explain the concept of exception safety.
- 47.
What is the difference between synchronous and asynchronous exceptions?
- 48.
How do you handle constructor failures using exceptions?
- 49.
What is the purpose of std::exception and its derived classes?
- 50.
How do you implement a stack unwinding mechanism?
Standard Template Library (STL)
- 51.
What is the Standard Template Library (STL)?
- 52.
Explain the difference between vector and list in STL.
- 53.
What are the associative containers in STL?
- 54.
How does an unordered_map work internally?
- 55.
What is the difference between set and multiset?
- 56.
Explain the concept of iterators in STL.
- 57.
What are function objects (functors) in STL?
- 58.
How do you use algorithms like sort, find, and binary_search in STL?
- 59.
What is the purpose of std::pair and std::tuple?
- 60.
Explain the concept of allocators in STL.
Concurrency and Multithreading
- 61.
What is multithreading in C++?
- 62.
How do you create and manage threads using std::thread?
- 63.
Explain the concept of mutex and its types in C++.
- 64.
What is a deadlock and how can it be prevented?
- 65.
How do you use condition variables for thread synchronization?
- 66.
What is the purpose of std::atomic?
- 67.
Explain the difference between std::async and std::thread.
- 68.
What is a thread pool and how would you implement one?
- 69.
How do you handle race conditions in C++?
- 70.
Explain the concept of memory ordering in C++ concurrency.
C++11 and Beyond Features
- 71.
What are lambda expressions in C++?
- 72.
Explain the ‘auto’ keyword and type inference.
- 73.
What is uniform initialization in C++11?
- 74.
How does range-based for loop work?
- 75.
What are delegating constructors?
- 76.
Explain the concept of rvalue references.
- 77.
What is perfect forwarding in C++?
- 78.
How do you use std::chrono for time-related operations?
- 79.
What are the improvements in smart pointers introduced in C++11?
- 80.
Explain the concept of constexpr.
Advanced C++ Concepts
- 81.
What is CRTP (Curiously Recurring Template Pattern)?
- 82.
Explain the concept of type erasure in C++.
- 83.
What are fold expressions in C++17?
- 84.
How do you implement a singleton pattern in C++?
- 85.
What is the purpose of std::optional?
- 86.
Explain the concept of concepts in C++20.
- 87.
What are coroutines in C++20?
- 88.
How do you use std::variant and std::visit?
- 89.
What is the purpose of std::any?
- 90.
Explain the concept of modules in C++20.
Performance and Optimization
- 91.
What is cache coherence and how does it affect C++ program performance?
- 92.
How do you optimize memory usage in C++ programs?
- 93.
Explain the concept of branch prediction and its impact on performance.
- 94.
What is loop unrolling and when is it beneficial?
- 95.
How do you profile C++ code for performance optimization?
- 96.
What is the difference between constexpr and inline functions in terms of performance?
- 97.
Explain the concept of false sharing and how to avoid it.
- 98.
How do you optimize code for modern CPU architectures (e.g., SIMD instructions)?
- 99.
What are some techniques for reducing compile times in large C++ projects?
- 100.
How do you implement and use lock-free data structures for better concurrency performance?