What should I review for a C++ interview?

Start with language basics, then check how well you can explain memory and objects. Use the questions below to test whether you can explain the differences between language features and write code that uses them.

Which C++ basics should I check first?

Basics appeared in 18 of 42 interviews. The most asked questions covered how C++ differs from C and Python, and what features and advantages C++ offers.

Can you answer these without only listing terms?

  • How does C++ differ from C and Python?
  • What features would make you choose C++ for a task?
  • How do passing by value and passing by reference differ?
  • What does const mean for a variable and for a member function?

Can I explain memory ownership and object behavior?

Memory questions appeared in 11 of 42 interviews. Check whether you can explain when you would use unique_ptr, shared_ptr, or weak_ptr, not just name them. Can you also explain copying and moving resources?

For objects, can you explain the diamond problem in multiple inheritance? Can you give examples of compile-time and runtime polymorphism? Check whether you can describe how a virtual function call differs from a non-virtual call.

What did reviewed answers miss?

For static member functions, 3 of 5 reviewed answers missed the distinction between the class and an object's state. Static member functions belong to the class. Non-static member functions operate on a particular object's state.

Check your own explanation of static and non-static member functions. Does it make that distinction clear?

What code should I try writing?

A coding task appeared in 10 of 42 interviews. Try writing code for these tasks from the interviews:

  • Take 15 random numbers, sort them, and print them.
  • Create classes A and B, then a class C that inherits from both.
  • Create a 3 × 3 two-dimensional vector.
  • Find the second-largest element in an integer array, or return “not found” if none exists.
  • Find a palindrome in a stream.

What should I check beyond the basics?

Can you explain container memory layouts and iterator invalidation? Can you describe the stages of compilation? For debugging, can you explain how you would use sanitizers, profiling, and static analysis to investigate a problem?

For systems topics, can you explain endianness and show how to manipulate bits? For design and testing, can you describe how unit testing differs from integration testing?

Who gets asked C++

Backend developer13 interviews
Embedded engineer7 interviews
Game developer2 interviews
Hardware engineer2 interviews

The 20 most asked C++ questions

Counted by interview, not by mention: a question asked twice in one conversation counts once.

  1. How does C++ differ from C and Python?

    Asked in 5 of 42 interviews · last asked Oct 8 · Concept · Junior

    Show answer

    C++ adds classes, templates, and resource management tools to C-style low-level programming. C and C++ are statically typed and usually compiled to native code; Python is dynamically typed. C++ gives more direct control over memory and performance, while Python manages memory automatically and often needs less code. C++ is not fully compatible with C.

    • C mainly uses procedural programming; C++ also supports object-oriented and generic programming.
    • C++ uses RAII and smart pointers to manage resources without manual cleanup in most application code.
    • Python usually runs slower, but native libraries can make expensive operations fast.

    What the interviewer checks: The interviewer checks whether you understand differences in typing, programming styles, memory management, and performance.

    Other ways it was asked
    • “What is the difference between C and C++?”
    • “What’s the difference between C++ and the C language?”
    • “What’s the difference between C and C++ and Python?”
  2. What is C++, what features and advantages does it offer, and when would you use it?

    Asked in 5 of 42 interviews · last asked Aug 10 · Concept · Junior

    Show answer

    C++ is a general-purpose, usually compiled language that gives strong control over performance and memory. It supports procedural, object-oriented, and generic programming. Its advantages include efficient execution, reusable abstractions, and a rich standard library. I would use it for systems software, game engines, embedded systems, or applications where speed and resource limits matter.

    • Classes support object-oriented design; templates support generic, reusable code.
    • RAII ties resource cleanup to object lifetime; smart pointers help manage memory ownership.
    • C++ offers low-level control, but unsafe memory access can cause bugs and security problems.
    • Portable code can target many platforms, but platform-specific code needs changes.

    What the interviewer checks: The interviewer checks whether you can connect C++ features to practical benefits, risks, and suitable uses.

    Other ways it was asked
    • “What are the advantages of C++?”
    • “What is C++, and what are its advantages?”
    • “What is C++?”
  3. How do passing by value and passing by reference work in C++, and how do they differ?

    Asked in 4 of 42 interviews · last asked Aug 12 · Concept · Junior

    Show answer

    Passing by value gives the function its own parameter object. Passing by reference makes the parameter refer to the caller’s object. Changing a value parameter does not change the caller’s object, while changing it through a non-const reference does. A const reference prevents changes through that reference.

    • Use T for a value parameter, T& for a reference, and const T& for a read-only reference.
    • Value parameters may be copied or moved; copying large objects can be costly.
    • A const reference can avoid copying when a function only needs to read an object.
    • A copied pointer still points to the same object, so the function may change that object.
    Code
    void byValue(int n) { n = 10; }
    void byReference(int& n) { n = 10; }
    
    int main() {
        int x = 1;
        byValue(x);     // x is still 1
        byReference(x); // x is now 10
    }

    What the interviewer checks: The interviewer is checking whether you understand copying, changes to caller data, and when to use const references.

    Other ways it was asked
    • “What is the difference between pass-by-value and pass-by-reference in C++?”
    • “What’s the difference between C++ call by value and call by reference?”
    • “What’s the difference between passing arguments by value and by reference in C++?”
  4. What is the diamond problem in multiple inheritance?

    Asked in 3 of 42 interviews · last asked Oct 9 · Concept · Junior

    Show answer

    In C++, the diamond problem happens when a class inherits from two classes that share a base class. Without virtual inheritance, the final class contains two copies of that base, which can make member access ambiguous. Making both intermediate classes inherit virtually from the shared base gives the final class one shared base object.

    • Both intermediate classes must use virtual inheritance for the shared base.
    • The most-derived class initializes the virtual base.
    • Explicit qualification can select a branch, but it does not remove duplicate base objects.

    What the interviewer checks: The interviewer checks whether you understand duplicate base objects, ambiguous member access, and how virtual inheritance handles them.

    Other ways it was asked
    • “What is the diamond problem in C++ multiple inheritance?”
    • “How can the diamond problem in C++ multiple inheritance be handled?”
  5. What is polymorphism in C++, and how do compile-time and runtime polymorphism differ? Give examples.

    Asked in 3 of 42 interviews · last asked Oct 9 · Concept · Junior

    Show answer

    Polymorphism lets one interface work with different types. Compile-time polymorphism uses overloads or templates, resolved during compilation. Runtime polymorphism uses virtual functions: a call through a base pointer or reference runs the override for the object's actual type.

    • Function overloading, operator overloading, and templates provide compile-time polymorphism.
    • Compile-time polymorphism does not require inheritance; runtime polymorphism uses inheritance and virtual functions.
    • Static selection can help optimization; runtime dispatch supports types chosen while the program runs.
    • Non-virtual calls are selected using the pointer or reference's static type.
    Code
    #include <iostream>
    int square(int x) { return x * x; }
    double square(double x) { return x * x; }
    struct Shape { virtual double area() const = 0; virtual ~Shape() = default; };
    struct Square : Shape { double area() const override { return 4.0; } };
    int main() {
        Square object; Shape& shape = object;
        std::cout << square(3) << ' ' << square(2.5) << '\n'; // Overloads
        std::cout << shape.area() << '\n'; // Virtual call: Square::area
    }

    What the interviewer checks: The interviewer checks whether you can explain static selection, virtual dispatch, and examples of both.

    Other ways it was asked
    • “What is polymorphism in C++?”
    • “Can you explain polymorphism and how it helps in C++?”
    • “Besides when they occur, how do compile-time and runtime polymorphism differ in C++?”
  6. How do unique_ptr, shared_ptr, and weak_ptr differ, and when would you use each?

    Asked in 3 of 42 interviews · last asked Oct 4 · Concept · Mid-level

    Show answer

    std::unique_ptr has one owner; use it when ownership does not need to be shared. std::shared_ptr allows several owners and destroys the object when the last shared owner releases it. std::weak_ptr observes an object managed by shared_ptr without keeping it alive; use it for back-references or to break ownership cycles.

    • Prefer unique_ptr by default. It cannot be copied, but moving it transfers ownership.
    • Copying shared_ptr shares ownership and adds reference-counting overhead.
    • Call weak_ptr::lock() to get a shared_ptr; it returns empty if the object has expired.
    • Cycles of shared_ptr owners can keep objects alive forever; use weak_ptr for non-owning links.

    What the interviewer checks: The interviewer checks whether you can choose ownership rules that prevent leaks and access to destroyed objects.

    Other ways it was asked
    • “What are the key differences between std::unique_ptr and std::shared_ptr in C++?”
    • “What is the difference between std::unique_ptr and std::shared_ptr, and when would you choose one over the other?”
    • “Could you expand on how you decide between using unique_ptr, shared_ptr, and weak_ptr in a real system?”
  7. What are pointers, what do they point to, and how are they used?

    Asked in 3 of 42 interviews · last asked Oct 9 · Concept · Junior

    Show answer

    A pointer holds the address of an object or function, or a null value. Use `&` to get an object's address and `*` to access the object through its pointer. Pointers let code modify existing objects, work with arrays, and manage dynamic memory.

    • A pointer's type tells the compiler what kind of object or function it points to.
    • Never dereference a null, uninitialized, or dangling pointer.
    • Pointer arithmetic is limited to an array and its one-past-the-end position; never dereference that position.
    • A raw pointer does not imply ownership. Prefer smart pointers for owning dynamic objects in modern C++.
    Code
    int main() {
        int value = 10;
        int* p = &value; // p points to value
        *p = 20;         // value is now 20
        return 0;
    }

    What the interviewer checks: The interviewer is checking whether you understand addresses, dereferencing, useful pointer operations, and pointer safety.

    Other ways it was asked
    • “Can you explain what pointers point to and how they are used in C and C++?”
    • “Can you explain pointers in C++, how they are used, and why they are useful?”
    • “What are pointers in C++?”
  8. What does const mean for variables and member functions in C++, and why use it?

    Asked in 2 of 42 interviews · last asked Aug 27 · Concept · Junior

    Show answer

    A const variable cannot be assigned a new value after initialization. A const member function cannot change the object's non-mutable data members and can be called on const objects. Use const to prevent accidental changes, show intent, and let the compiler enforce these limits.

    • A member function is const when const appears after its parameter list.
    • Mutable data members can still change inside a const member function.
    • A const reference prevents changes through that reference; it does not necessarily make the underlying object immutable.
    • Const does not always mean the value is known at compile time.

    What the interviewer checks: The interviewer checks whether you understand const restrictions and use them to make interfaces safer and clearer.

    Other ways it was asked
    • “What do const variables and const member functions mean in C++?”
    • “Why would you use const in C++?”
  9. What are static member functions, and how do they differ from non-static member functions?

    Asked in 2 of 42 interviews · last asked Oct 9 · Concept · Junior

    Show answer

    A static member function belongs to the class and can be called without an object. It has no `this` pointer, so it needs an object to access non-static members. A non-static member function runs on a particular object and can access that object's state directly.

    • Call a static member function using ClassName::functionName().
    • Static member functions can directly access static data members and other static member functions.
    • A static data member is shared by all objects; a non-static data member belongs to each object.
    • Static member functions cannot be virtual.

    What the interviewer checks: The interviewer checks whether you understand class-level functions, object-level state, and the role of `this`.

    Common mistake (in 3 of 5 reviewed answers): Many answers forget that static member functions need an object to access non-static members.

    Other ways it was asked
    • “What are static variables and static member functions in C++?”
    • “How do static variables and static member functions differ from their non-static counterparts in C++?”
    • “What is a static member function in C++?”
  10. What are virtual functions in C++, and how do their calls differ from non-virtual function calls?

    Asked in 2 of 42 interviews · last asked Oct 9 · Concept · Junior

    Show answer

    Virtual functions are member functions that support runtime polymorphism. When called through a base-class pointer or reference, a virtual function uses the override for the object's actual type. A non-virtual function call is selected using the pointer or reference's declared type. Use virtual functions when derived classes need different behavior through a shared interface.

    • Declare the base function virtual; matching overrides remain virtual in derived classes.
    • Use override on derived functions so the compiler checks that they really override a base function.
    • An explicitly qualified call, such as Base::show(), bypasses virtual dispatch.

    What the interviewer checks: The interviewer checks whether you understand runtime polymorphism and the difference between declared type and actual object type.

    Other ways it was asked
    • “Why would you declare a function as virtual in C++?”
    • “What is the purpose of virtual functions in C++?”
    • “What are virtual functions in C++?”
  11. What makes C++ object-oriented, and which object-oriented programming features does it support?

    Asked in 2 of 42 interviews · last asked Jul 16 · Concept · Junior

    Show answer

    C++ is object-oriented because it lets you organize data and functions into classes and create objects from them. It supports encapsulation, abstraction, inheritance, and polymorphism. C++ also supports other programming styles, so not all code must use objects.

    • Encapsulation groups data and functions, with public, protected, and private access controlling visibility.
    • Abstraction exposes an interface while hiding implementation details.
    • Inheritance lets one class build on another; C++ also supports multiple inheritance.
    • Virtual functions enable runtime polymorphism through base-class pointers or references.

    What the interviewer checks: The interviewer is checking whether you understand the main object-oriented features and how C++ provides them.

    Other ways it was asked
    • “What object-oriented programming features does C++ support?”
    • “What does it mean for C++ to be an object-oriented programming language?”
  12. How do smart pointers manage memory in C++, and when is manual memory management still necessary?

    Asked in 2 of 42 interviews · last asked Oct 9 · Concept · Junior

    Show answer

    Smart pointers use RAII to release owned memory automatically when ownership ends. They help prevent leaks, including when exceptions occur. Manual allocation and release may still be needed inside custom allocators or when working with C APIs, but these operations should usually be wrapped in RAII objects.

    • std::unique_ptr has one owner, supports ownership transfer, and deletes its object when destroyed.
    • std::shared_ptr counts shared owners and deletes its object when the last owner releases it.
    • std::weak_ptr observes shared ownership without extending object lifetime and can break shared_ptr ownership cycles.
    • Custom deleters let smart pointers use cleanup functions other than delete.

    What the interviewer checks: The interviewer is checking whether you understand ownership, automatic cleanup, and when explicit memory handling is still needed.

    Other ways it was asked
    • “What are smart pointers?”
    • “What are smart pointers in C++?”
    • “How do smart pointers in C++ manage memory, and when does manual memory management remain necessary?”
  13. How do you manage memory in C++?

    Asked in 2 of 42 interviews · last asked Oct 14 · Concept · Mid-level

    Show answer

    In C++, I use automatic objects and RAII to release resources when their owners are destroyed. I prefer standard containers and std::unique_ptr, using std::shared_ptr only for shared ownership. I avoid raw new and delete when possible. In C, I use malloc or calloc and release the memory with free.

    • RAII handles cleanup even when exceptions occur.
    • Match new with delete, new[] with delete[], and malloc or calloc with free.
    • Keep ownership clear to avoid leaks, double frees, and access after memory is freed.
    • C allocation functions return null on failure; ordinary C++ new throws std::bad_alloc.

    What the interviewer checks: The interviewer checks whether you understand ownership, object lifetime, safe cleanup, and the difference between C and C++.

    Other ways it was asked
    • “How would you manage memory allocation in C?”
  14. What is the difference between reserve and resize on a std::vector, and what happens to size and element values in each case?

    Asked in 2 of 42 interviews · last asked Oct 4 · Concept · Junior

    Show answer

    reserve(n) increases capacity if needed, but leaves size and element values unchanged. resize(n) changes size: growing adds elements, while shrinking destroys elements at the end. New elements are default-inserted, or copied from the value supplied to resize(n, value).

    • Capacity is allocated space; size is the number of actual elements.
    • reserve never reduces capacity, and shrinking with resize does not reduce capacity.
    • With the default allocator, resize(n) initializes new int elements to zero.
    • Reallocation moves or copies existing elements and invalidates all pointers, references, and iterators to them.
    Code
    std::vector<int> v{1, 2};
    v.reserve(10);  // size: 2, capacity: at least 10, values: {1, 2}
    v.resize(4);    // size: 4, values: {1, 2, 0, 0}
    v.resize(5, 7); // size: 5, values: {1, 2, 0, 0, 7}
    v.resize(1);    // size: 1, values: {1}, capacity unchanged

    What the interviewer checks: The interviewer checks whether you distinguish allocated storage from live elements and understand construction, destruction, and reallocation.

    Other ways it was asked
    • “In a vector, what's the difference between reserve(n) and resize(n) in terms of element construction, destruction, and observable size?”
  15. Write a C++ program that takes 15 random numbers, sorts them, and prints them.

    Asked in 2 of 42 interviews · last asked Aug 12 · Write code · Junior

    Show answer

    This C++ program generates 15 random integers, sorts them in ascending order, and prints them. It stores the numbers in an array and uses std::sort. The numbers range from 0 to 99, and duplicates are allowed.

    • std::sort sorts integers in ascending order by default.
    • The random number generator is seeded once, before the loop.
    • This program requires C++11 or later.
    Code
    #include <algorithm>
    #include <array>
    #include <iostream>
    #include <random>
    int main() { std::array<int, 15> numbers;
        std::mt19937 rng(std::random_device{}());
        std::uniform_int_distribution<int> dist(0, 99);
        for (int& n : numbers) n = dist(rng);
        std::sort(numbers.begin(), numbers.end()); for (int n : numbers) std::cout << n << '\n';
    }

    What the interviewer checks: The interviewer is checking whether you can generate numbers, store them, sort them, and print the result.

    Other ways it was asked
    • “Write a C++ program that generates 10 random numbers, sorts them in ascending order, and prints them.”
    • “Write a C++ program that stores 15 random names in an array, sorts them alphabetically, and prints them.”
    • “Write a Java program that takes 15 random numbers, sorts them, and prints them.”
  16. Given the `scanf` format specifiers `%d`, `%f`, and `%c`, do they represent the same or different input types, and which types do they correspond to?

    Asked once · last asked Jun 10 · Concept · Junior

    Show answer

    They represent different input types. In `scanf`, `%d` reads a decimal integer into an `int`, `%f` reads a floating-point value into a `float`, and `%c` reads a character into a `char`. Each requires a pointer to the matching destination type.

    • Pass variable addresses, usually with `&`, so `scanf` can store the input.
    • For `scanf`, `%f` needs `float*`; `%lf` needs `double*`.
    • `%c` does not skip leading whitespace; `%d` and `%f` do.

    What the interviewer checks: The interviewer is checking whether you match input formats to the correct variable types and pointer arguments.

  17. Why might you choose Python over C++ despite Python's slower execution speed?

    Asked once · last asked Aug 25 · Concept · Mid-level

    Show answer

    I would choose Python when fast development and easy maintenance matter more than raw execution speed. Its simple syntax and large library ecosystem help teams build solutions quickly. It often fits automation, prototypes, and tasks that mostly wait for files or network responses. Performance-heavy work can use libraries with compiled code.

    • Less code can mean faster development and easier maintenance.
    • Existing libraries reduce the amount of code you need to write.
    • Slower execution matters less when most time is spent waiting for input or output.
    • C++ is often better when tight latency or memory control is required.

    What the interviewer checks: The interviewer is checking whether you can balance runtime performance against development time and project needs.

  18. What is the largest value that can be stored in a C++ int?

    Asked once · last asked Jan 27 · Concept · Junior

    Show answer

    The largest value of a C++ int depends on the implementation. It is usually 2,147,483,647 for a 32-bit int, but C++ only guarantees a maximum of at least 32,767. Use INT_MAX from <climits> or std::numeric_limits<int>::max() from <limits> to get the actual maximum.

    • A plain int is signed.
    • The implementation determines the size and range of int.
    • A 64-bit system does not necessarily use 64-bit int values.

    What the interviewer checks: The interviewer is checking whether you distinguish common integer limits from portable C++ guarantees.

    Other ways it was asked
    • “What determines the maximum value of an int in C++?”
  19. What are the different data types present in C++?

    Asked once · last asked Aug 10 · Concept · Junior

    Show answer

    C++ has fundamental types and compound types. Fundamental types include `bool`, character types, integer types, floating-point types, `void`, and `std::nullptr_t` (since C++11). Compound types include arrays, pointers, references, function types, classes, unions, and enums.

    • Integer types include signed and unsigned versions of short, int, long, and long long.
    • Standard floating-point types are float, double, and long double.
    • Classes include types declared with class or struct; enums define named constants.
    • Type sizes can vary by implementation; int is at least 16 bits.

    What the interviewer checks: The interviewer checks whether you know the main type categories and avoid assuming fixed type sizes.

  20. What does `std` represent in C++?

    Asked once · last asked Aug 10 · Concept · Junior

    Show answer

    `std` is the namespace used by the C++ standard library. It holds names such as `cout`, `string`, and `vector`. You use the scope resolution operator `::` to access these names, as in `std::string`.

    • A namespace groups names and helps avoid naming conflicts.
    • Include the correct header before using a standard library feature.
    • Writing `std::` avoids needing `using namespace std;`.

    What the interviewer checks: The interviewer is checking whether you understand namespaces and how to refer to standard library names.

C++ basics interview questions

Start with C++ features, language comparisons, data types, const, functions, references, input, namespaces, and command-line arguments. 14 questions.

  1. What is a reference in C++?

    Asked once · last asked Aug 10 · Concept · Junior

  2. What is a token in C++?

    Asked once · last asked Aug 10 · Concept · Junior

  3. What do Python's 1 + 1 and C's 0.3 + 0.3 produce, and how do their types affect the results?

    Asked once · last asked Aug 14 · Concept · Junior

    Other ways it was asked
    • “What is the result of 0.3 + 0.3 in C?”
    • “What results do 1 + 1 in Python and 0.3 + 0.3 in C produce, and how do data types affect them?”
  4. What do `argc` and `argv` represent when handling command-line arguments?

    Asked once · last asked Aug 26 · Concept · Junior

  5. What are inline functions in C++?

    Asked once · last asked Oct 9 · Concept · Junior

C++ object-oriented programming interview questions

Review how classes use access control, static members, constructors, destructors, inheritance, encapsulation, and polymorphism. 14 questions.

  1. Can you write a C++ example with classes A and B and a class C that inherits from both?

    Asked once · last asked Aug 27 · Write code · Junior

  2. What guidelines do you use to decide whether a class member should be private or public in C++?

    Asked once · last asked Jul 16 · Concept · Junior

  3. In C++, which class's constructor is called first when a derived class is constructed?

    Asked once · last asked Oct 16 · Concept · Junior

  4. When might you choose not to use encapsulation in a C++ solution?

    Asked once · last asked Jan 27 · Scenario · Mid-level

  5. What are constructors and destructors used for during an object's lifecycle in C++?

    Asked once · last asked Jul 16 · Concept · Junior

  6. What are some important rules and use cases for destructors in C++?

    Asked once · last asked Jul 16 · Concept · Junior

  7. In C++, what does a derived class inherit from its base class?

    Asked once · last asked Jul 16 · Concept · Junior

  8. Can we do multiple inheritance in C++?

    Asked once · last asked Aug 27 · Concept · Junior

  9. How do you declare and create an object in C++?

    Asked once · last asked Oct 16 · Concept · Junior

C++ pointers and memory management interview questions

Check your understanding of pointers, storage duration, stack and heap allocation, RAII, smart pointers, ownership, value categories, and copying or moving resources. 13 questions.

  1. Could you explain the differences between stack and heap allocation in C++, and how RAII helps manage resources safely?

    Asked once · last asked Jun 15 · Concept · Junior

  2. What happens internally to the control block of a std::shared_ptr when you copy the shared pointer and when you destroy one copy?

    Asked once · last asked Sep 21 · Concept · Mid-level

    Other ways it was asked
    • “What happens internally to a std::shared_ptr control block when you copy it and when you destroy one copy?”
  3. How does memory management in .NET and C# differ from memory management in C++?

    Asked once · last asked Sep 29 · Concept · Senior

  4. In C++, what is the rule of five, and which five special member functions does it refer to?

    Asked once · last asked Oct 4 · Concept · Mid-level

  5. Can you explain lvalues and rvalues in C++?

    Asked once · last asked Oct 9 · Concept · Junior

  6. What is a unique pointer in C++, and how is it used?

    Asked once · last asked Oct 9 · Concept · Junior

    Other ways it was asked
    • “What is a shared pointer in C++, and how is it used?”
  7. What is the Rule of Three in C++?

    Asked once · last asked Oct 9 · Concept · Mid-level

  8. Where is a static variable in C stored, and how does its storage differ from heap-allocated memory?

    Asked once · last asked Jun 29 · Concept · Junior

  9. What do semantics and RAII mean in C++?

    Asked once · last asked Aug 12 · Concept · Mid-level

C++ STL and templates interview questions

Explore templates and standard containers, including memory layouts, capacity, iterator invalidation, hashing, queues, and heaps. 14 questions.

  1. How would you create a 3 × 3 two-dimensional vector in C++?

    Asked once · last asked Aug 19 · Write code · Junior

  2. In C++, when you call reserve(n) on a vector, what exactly happens in memory if n is greater than the current capacity?

    Asked once · last asked Sep 21 · Concept · Mid-level

  3. In C++, in a hash map that uses separate chaining, what exactly is stored in the bucket array and how are the key value pairs laid out in memory?

    Asked once · last asked Sep 21 · Concept · Mid-level

  4. In C++, for a hash map that uses open addressing like linear or quadratic probing, where are entries stored and what happens to the probe sequence when an element is erased?

    Asked once · last asked Sep 21 · Concept · Mid-level

  5. In C++, what are the differences between std::vector and std::deque, including memory layout and push/pop complexity at the front and back?

    Asked once · last asked Oct 4 · Concept · Mid-level

  6. In a std::vector, what happens to the addresses of existing elements after a reallocation, and which operations can trigger that reallocation?

    Asked once · last asked Oct 4 · Concept · Senior

  7. In an unordered_map, what exactly invalidates iterators, and does a rehash invalidate references and pointers to elements as well?

    Asked once · last asked Oct 4 · Concept · Senior

  8. How is a queue typically implemented under the hood in C++, which underlying container does it use by default, and what property does that choice provide compared to using a dynamic array directly?

    Asked once · last asked Oct 4 · Concept · Junior

  9. In C++, explain the difference between std::vector::size() and std::vector::capacity().

    Asked once · last asked Sep 21 · Concept · Junior

    Other ways it was asked
    • “In C++, explain the difference between std::vector::size() and std::vector::capacity(), and what happens during reallocation when capacity grows.”
  10. What are C++ templates, and what is std::vector?

    Asked once · last asked Aug 3 · Concept · Junior

  11. What is a linked list in C++?

    Asked once · last asked Aug 12 · Concept · Junior

  12. What is the C++ Standard Template Library (STL), and what does it provide?

    Asked once · last asked Sep 18 · Concept · Junior

Show 1 more
  1. For a binary heap used by a priority_queue, how is the heap stored in memory?

    Asked once · last asked Oct 4 · Concept · Junior

C++ coding interview questions

Try coding tasks on sorting, arrays, linked lists, strings, streams, subarray sums, and tree traversal. 7 questions.

  1. Write a C++ function that takes an array of integers (each between -1,000,000 and 1,000,000, with at most 10,000 elements) and returns the second-largest element, or “not found” if there is no second-largest element.

    Asked once · last asked Jun 26 · Write code · Junior

  2. Write C++ code to find a palindrome in a stream.

    Asked once · last asked Aug 7 · Write code · Junior

  3. Can you create me a C++ program that takes in 10 random names, alphabetizes them, and prints them on the screen?

    Asked once · last asked Aug 12 · Write code · Junior

  4. Write a C++ program that takes 10 random numbers, stores them in a linked list, and prints them.

    Asked once · last asked Aug 12 · Write code · Junior

  5. Can you create a tree representation in C++ with shapes stored in the nodes, then implement a post-order traversal, making production-style design choices and doing a little testing?

    Asked once · last asked Aug 12 · Write code · Mid-level

  6. Write complete C++ code to count subarrays whose sums are divisible by k.

    Asked once · last asked Oct 15 · Write code · Mid-level

C++ systems programming interview questions

Systems questions cover data representation, endianness, bit manipulation, concurrency, operating-system calls, language interoperability, and DPI-C verification. 13 questions.

  1. What concurrency issues would you look for in a multithreaded C++ statistics tracker?

    Asked once · last asked Jul 16 · Scenario · Mid-level

    Other ways it was asked
    • “How would you handle concurrency for a counter in a multithreaded C++ statistics tracker?”
  2. What do little-endian and big-endian mean in terms of how bytes are stored in memory?

    Asked once · last asked Feb 9 · Concept · Junior

  3. How does C code detect a system's endianness, why set an integer variable to 1, and what is checked afterward?

    Asked once · last asked Feb 9 · Concept · Junior

  4. Could you explain how you would approach interoperability between C++ and C or other languages?

    Asked once · last asked Jun 15 · Scenario · Mid-level

    Other ways it was asked
    • “What pitfalls do you usually watch out for during interoperability between C++ and other languages?”
  5. How would you modify bit 10 of a 32-bit integer in C?

    Asked once · last asked Jul 16 · Write code · Junior

  6. How do you use DPI-C to implement directed C test scenarios?

    Asked once · last asked Sep 24 · Tooling · Mid-level

  7. How do you use DPI-C functions to implement prediction?

    Asked once · last asked Sep 24 · Tooling · Mid-level

  8. Besides register configuration, how can DPI-C functions be used in a system or low-level UVM environment?

    Asked once · last asked Sep 24 · Tooling · Senior

  9. How do structures and unions differ in memory layout, and when would you use each?

    Asked once · last asked Jan 22 · Concept · Junior

    Other ways it was asked
    • “Could you differentiate between structures and unions with respect to memory?”
    • “When would you use a structure versus a union in C?”
  10. What is the purpose of the `register` storage class in C, and does it guarantee faster variable access?

    Asked once · last asked Jun 10 · Concept · Junior

    Other ways it was asked
    • “How does the `register` storage class in C make a variable faster to access?”
  11. How are signed numbers represented in a 32-bit processor?

    Asked once · last asked Jun 10 · Concept · Junior

  12. What does the `wait()` system call do in C, how does it work, and why is it useful?

    Asked once · last asked Sep 1 · Concept · Mid-level

Show 1 more
  1. What happens behind the scenes when a function is called?

    Asked once · last asked Jan 22 · Concept · Junior

C++ compilation and build tools interview questions

Build questions cover headers, compilation stages, assemblers, native code, LLVM, MLIR, and large mixed-language toolchains. 7 questions.

  1. What advantages do compiled programming languages have over interpreted languages?

    Asked once · last asked Jan 27 · Concept · Junior

    Other ways it was asked
    • “Why can compiled languages be faster or more performant than interpreted languages?”
    • “What other advantages do compiled languages have over interpreted languages?”
    • “What are the disadvantages of compiled languages compared with interpreted languages?”
  2. What stages build a C++ program, and what does the compiler produce?

    Asked once · last asked Jan 27 · Concept · Junior

    Other ways it was asked
    • “What tools or stages are involved in building a C++ program?”
    • “What other tools or stages are involved in building a C++ program?”
    • “Does the C++ build process use a compiler?”
  3. What are LLVM and MLIR, and how are they used in compiler development?

    Asked once · last asked Aug 12 · Concept · Senior

  4. What is an assembler, and what role does it play in building a C++ program?

    Asked once · last asked Jan 27 · Concept · Junior

    Other ways it was asked
    • “What role does an assembler play in the C++ build process?”
    • “What is an assembler?”
  5. How would you approach designing a large-scale build toolchain that supports both C++ and Python, especially in a distributed engineering organization?

    Asked once · last asked Jun 1 · Design · Senior

  6. What is the correct syntax for including a user-defined header file in C++?

    Asked once · last asked Jul 2 · Concept · Junior

    Other ways it was asked
    • “Which of the following is the correct syntax for including a user-defined header file in C++?”
  7. What is native code?

    Asked once · last asked Jan 27 · Concept · Junior

    Other ways it was asked
    • “What language is native code written in?”

C++ debugging and performance interview questions

Debugging questions focus on undefined behavior, dangling pointers, memory leaks, sanitizers, profiling, static analysis, and performance problems. 7 questions.

  1. Could you share a practical example of a challenging C++ performance or correctness issue you have solved, and explain how you systematically narrowed down the root cause?

    Asked once · last asked Jun 15 · Behavioral · Mid-level

  2. Could you explain how you use tools like sanitizers, profilers, and static analyzers to enhance the quality of C++ codebases?

    Asked once · last asked Jun 15 · Tooling · Mid-level

    Other ways it was asked
    • “Which sanitizers, profilers, and static analyzers do you prefer for C++ development, and why?”
  3. What causes undefined behavior in C++, and how could you avoid it?

    Asked once · last asked Aug 12 · Concept · Mid-level

  4. How can a memory leak occur when using smart pointers in C++?

    Asked once · last asked Oct 9 · Concept · Mid-level

  5. How would you find and fix a memory leak in C using malloc and free?

    Asked once · last asked Oct 14 · Scenario · Junior

  6. What is a dangling pointer?

    Asked once · last asked Sep 2 · Concept · Junior

  7. What improvements or optimizations are commonly needed in C-based mini shells and client-server systems?

    Asked once · last asked Oct 21 · Concept · Mid-level

C++ software design and testing interview questions

Consider modular architecture, API documentation, maintainability, unit and integration testing, and safety-critical coding standards. 4 questions.

  1. How do you ensure that a large C++ codebase remains modular, testable, and maintainable over time?

    Asked once · last asked Jun 15 · Design · Senior

    Other ways it was asked
    • “What best practices do you follow to keep a large C++ codebase modular, testable, and maintainable?”
  2. Why might pointer use be restricted in safety-critical projects, such as aerospace software, or by coding standards such as MISRA?

    Asked once · last asked Jun 10 · Concept · Mid-level

    Other ways it was asked
    • “Why are pointers prohibited in some projects, such as aerospace projects, or under standards such as MISRA?”
  3. Could you explain how you manage and document complex C++ APIs or subsystems to help other engineers understand the decisions and usage patterns?

    Asked once · last asked Jun 15 · Scenario · Senior

  4. Could you discuss your strategy for organizing unit tests and integration tests for C++ code, especially when dealing with hardware- or OS-specific behavior?

    Asked once · last asked Jun 15 · Scenario · Senior

Live coding round next? Coding mode in the MeetAssist desktop app solves the problem on your screen, with your phone as the remote.

How this list is made

Every question here was asked by a real interviewer in a real job interview that a candidate ran MeetAssist in. After the call, the interviewer's questions are pulled from the transcript. Practice sessions, tests, exams and anything that was not a job interview are dropped.

Questions are rewritten so they make sense on their own: names of people, employers and clients are removed, and speech-to-text mistakes are fixed. Small talk, logistics and questions about one candidate's own résumé are left out. Rephrasings of the same question are merged, and the count is the number of different interviews it came up in.

The interviews come from candidates who use MeetAssist, so they lean towards software, data and AI roles: the shares describe these interviews, not every C++ interview. Answers to the most asked questions are written and checked by an editor; a "common mistake" is shown only when reviews of real answers in these interviews show it, with the count.

42 interviews, 36 candidates, Jan 2026 to Oct 2026. Updated every month with new interviews.