Questions
C++ questions
Choose a question page, learn the concept, then test your understanding with a quiz.
What Is Move Semantics in C++? A Beginner-Friendly Guide
Learn what move semantics means in C++, why it matters, how move constructors work, and when moving is better than copying.
What the explicit Keyword Means in C++
Learn what the explicit keyword means in C++, how it affects constructors and conversions, and how to prevent unwanted implicit conversions.
When to Use Virtual Destructors in C++
Learn when and why to use virtual destructors in C++, with examples of polymorphism, base pointers, object cleanup, and common mistakes.
When to Use static_cast, dynamic_cast, const_cast, and reinterpret_cast in C++
Learn when to use C++ casts safely: static_cast, dynamic_cast, const_cast, reinterpret_cast, and C-style casts with examples.
Why "using namespace std;" Is Discouraged in C++
Learn why `using namespace std;` is often discouraged in C++, what problems it can cause, and when explicit `std::` is safer.
Why C++ Templates Are Usually Implemented in Header Files
Learn why C++ templates are usually defined in header files, how instantiation works, and what alternatives exist in real projects.
Why C++ stdin Line Reading Can Be Slower Than Python: cin, sync_with_stdio, and fgets
Learn why C++ line input from stdin can be slower than Python and how sync_with_stdio(false) or fgets improves performance.
Why Separate Loops Can Be Faster Than a Combined Loop in C++: Cache, Memory Bandwidth, and Loop Optimization
Learn why splitting array updates into separate C++ loops can outperform a combined loop due to cache behavior, bandwidth, and compiler effects.
Why Small Type Changes Can Change Performance in C++ Hot Loops
Learn why changing a loop counter type in C++ can drastically affect CPU performance, assembly output, and popcount benchmarks.
Why Sorted Data Can Make an if Statement Faster in C++: Branch Prediction Explained
Learn why sorted arrays can make conditional loops much faster in C++ by improving CPU branch prediction and reducing mispredictions.
Why Virtual Functions Matter in C++: Polymorphism Explained
Learn why virtual functions are needed in C++, how overriding really works, and when dynamic dispatch matters in inheritance.
Why `+ 0.1f` Can Be Faster Than `+ 0` in C++: Compiler Optimization and Floating-Point Behavior
Learn why changing `0.1f` to `0` can slow C++ code dramatically due to compiler optimizations, floating-point math, and loop removal.
Page 2 of 2 - 32 questions