C++ Interview Questions

C++ interview questions test memory management, templates, the STL, and object-oriented principles including polymorphism and inheritance. C++ (CPP) roles in games, finance, and systems software expect you to reason about performance and ownership, not just write code that compiles. This page covers 40 real C++ interview questions with answers across four formats: multiple choice, written answers, spoken responses, and live coding challenges, the same mix used in modern technical interviews.

Practice each question in your browser with no signup required. Answers stay hidden until you attempt the question: type, speak, or code your response first, then compare it against the model answer. Questions range from fundamentals for your first developer job to scenario-based questions for senior roles, so you can find the gaps in your knowledge before the real interview.

40 questions with answersLast updated: Oct 19, 2026
Start a mock interview

How to practice

  1. Choose a question. Pick any of the 40 questions. They mix multiple choice, written, spoken, and coding, the same mix a real interviewer uses.
  2. Attempt your answer. Select a multiple-choice option, type your written response, record a spoken answer, or write code in the editor.
  3. Reveal the model answer. Once you have attempted the question, the model answer unlocks so you can compare it with yours.
  4. Move to the next question. Track how many questions you have attempted with the progress bar at the top of the page.
  5. Take a mock interview. When you are ready, try a full mock technical interview on Plaicer with AI-driven follow-up questions.

C++ Interview Questions and Answers

0 of 40 attempted
1Multiple choice

How would you describe C++ and what programming paradigms does it support?

Attempt the question first to reveal the answer.

2Written answer

Explain how C++ builds on C while adding object-oriented and functional features

Attempt the question first to reveal the answer.

3Spoken answer

Walk through how you would design a game character system using inheritance and polymorphism

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

4Coding

Implement a simple Vector2D class with overloaded operators for addition, subtraction, and dot product

class Vector2D {
private:
    double x, y;
public:
    Vector2D(double x = 0, double y = 0) : x(x), y(y) {}
    // Implement operators and methods
};

Attempt the question first to reveal the answer.

5Multiple choice

Explain object-oriented programming and its core principles

Attempt the question first to reveal the answer.

6Written answer

Describe the core principles: encapsulation, inheritance, polymorphism, and abstraction

Attempt the question first to reveal the answer.

7Spoken answer

Describe a situation where you used templates to write generic code and how you handled edge cases

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

8Coding

Create an Animal base class with virtual methods, and Derived Dog and Cat classes

class Animal {
public:
    virtual ~Animal() {}
    virtual void speak() = 0;
    // Add more virtual methods
};

Attempt the question first to reveal the answer.

9Multiple choice

What is a class and how does it differ from a structure in C++?

Attempt the question first to reveal the answer.

10Written answer

Explain how classes bundle data and methods, and how access specifiers control visibility

Attempt the question first to reveal the answer.

11Spoken answer

Explain how you would implement RAII in a file handling class to ensure proper cleanup

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

12Coding

Implement a generic linked list template that works with any data type

template<typename T>
class LinkedList {
private:
    struct Node { T data; Node* next; };
    Node* head;
public:
    LinkedList() : head(nullptr) {}
    // Implement list operations
};

Attempt the question first to reveal the answer.

13Multiple choice

How does encapsulation protect data and control access in object-oriented design?

Attempt the question first to reveal the answer.

14Written answer

Describe how private, public, and protected members implement encapsulation

Attempt the question first to reveal the answer.

15Spoken answer

Talk about a time you debugged a subtle memory issue related to virtual function calls

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

16Coding

Write a ResourceManager class using unique_ptr and shared_ptr for memory management

#include <memory>

class ResourceManager {
private:
    std::unique_ptr<Resource> exclusive;
    std::vector<std::shared_ptr<Resource>> shared;
public:
    // Implement resource management
};

Attempt the question first to reveal the answer.

17Multiple choice

Explain inheritance and how derived classes extend base class functionality

Attempt the question first to reveal the answer.

18Written answer

Explain single and multiple inheritance, and the issues multiple inheritance can create

Attempt the question first to reveal the answer.

19Spoken answer

Describe how you would design a composable animation system using templates and iterators

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

20Coding

Implement a Calculator class that throws custom exceptions for invalid operations

class DivisionByZero : public std::exception {
public:
    const char* what() const noexcept { return "Division by zero"; }
};

class Calculator {
public:
    double divide(double a, double b) {
        // Implement with exception throwing
    }
};

Attempt the question first to reveal the answer.

21Multiple choice

Describe polymorphism and how it enables flexible, extensible code

Attempt the question first to reveal the answer.

22Written answer

Contrast compile-time (function/operator overloading) and runtime (virtual functions) polymorphism

Attempt the question first to reveal the answer.

23Spoken answer

Explain how you would use STL containers and algorithms to solve a data processing problem efficiently

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

24Coding

Implement a Complex number class with operator overloading for arithmetic

class Complex {
private:
    double real, imag;
public:
    Complex(double r = 0, double i = 0) : real(r), imag(i) {}
    // Overload arithmetic operators
};

Attempt the question first to reveal the answer.

25Multiple choice

What role do virtual functions play in achieving runtime polymorphism?

Attempt the question first to reveal the answer.

26Written answer

Explain how virtual functions work through virtual tables and enable runtime method selection

Attempt the question first to reveal the answer.

27Spoken answer

Walk through how you would handle exceptions in a financial calculation system to maintain consistency

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

28Coding

Use STL containers and algorithms to sort and filter a collection of products by price

#include <vector>
#include <algorithm>

struct Product { std::string name; double price; };

void processProducts(std::vector<Product>& products) {
    // Sort and filter using STL algorithms
}

Attempt the question first to reveal the answer.

29Multiple choice

How do templates enable generic programming and code reuse in C++?

Attempt the question first to reveal the answer.

30Written answer

Describe template instantiation, specialization, and template metaprogramming

Attempt the question first to reveal the answer.

31Spoken answer

Describe how you would optimize a performance-critical loop using move semantics and modern C++

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

32Coding

Implement a File class using RAII to manage file handles safely

#include <fstream>

class File {
private:
    std::ifstream file;
public:
    File(const std::string& path) {
        file.open(path);
        if (!file) throw std::runtime_error("Cannot open file");
    }
    ~File() { file.close(); }
    // Add read methods
};

Attempt the question first to reveal the answer.

33Multiple choice

What is the Standard Template Library and what components does it provide?

Attempt the question first to reveal the answer.

34Written answer

Explain the components of STL and how they work together for generic programming

Attempt the question first to reveal the answer.

35Spoken answer

Talk about a time you encountered a diamond inheritance problem and how you resolved it

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

36Coding

Implement a String class with move constructor and move assignment operator

class String {
private:
    char* data;
    size_t length;
public:
    String(const String& other);
    String(String&& other) noexcept;
    String& operator=(String&& other) noexcept;
};

Attempt the question first to reveal the answer.

37Multiple choice

How does exception handling in C++ manage errors and maintain program state?

Attempt the question first to reveal the answer.

38Written answer

Describe exception propagation, stack unwinding, and best practices for exception safety

Attempt the question first to reveal the answer.

39Spoken answer

Explain how you would implement a type-safe wrapper around a C library using classes and RAII

This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.

Attempt the question first to reveal the answer.

40Coding

Create a generic Pair template with a specialization for pointer types

template<typename T, typename U>
class Pair {
public:
    T first; U second;
};

// Provide specialization for pointer types
template<typename T, typename U>
class Pair<T*, U*> {
    // Specialized implementation
};

Attempt the question first to reveal the answer.

Topics covered

  • C++ fundamentals: paradigms, how C++ builds on C, classes vs structs
  • Encapsulation and access specifiers
  • Inheritance: single, multiple, and the diamond problem
  • Polymorphism: virtual functions, vtables, compile-time vs runtime
  • Operator overloading
  • Templates: generic classes, specialization, metaprogramming
  • The STL: containers, iterators, algorithms
  • Memory and ownership: RAII, unique_ptr, shared_ptr
  • Move semantics: move constructors and move assignment
  • Exception handling: propagation, stack unwinding, exception safety

Frequently asked questions

How many C++ interview questions are on this page?
40 real C++ interview questions across four formats: multiple choice (10), written answer (10), spoken answer (10), and coding (10).
Do I need to sign up to practice?
No. All 40 questions and model answers are free with no signup. You attempt each question first, and the model answer unlocks once you have engaged.
Who are these C++ interview questions for?
Developers preparing for C++ technical interviews at any level, from first job to senior engineer roles. Questions cover fundamentals through real-world scenarios.
What topics do the C++ questions cover?
The questions cover object-oriented C++, including inheritance and polymorphism. They also test templates, the STL, and operator overloading. Other topics include memory ownership with RAII and smart pointers, move semantics, and exception handling.
Can I practice coding questions in the browser?
Yes. Coding questions include starter code in an in-browser editor, so you can write your solution without installing anything.
How often are the questions updated?
The question bank is reviewed regularly and updated to reflect current C++ interview patterns.
Can I take a full mock interview?
Yes. Plaicer's mock technical interview walks you through a realistic 30 to 45 minute interview with AI-driven follow-up questions.
Which C++ standard do the questions use?
Modern C++ (C++11 and later), including smart pointers, move semantics, and lambdas, alongside core OOP and templates.

Pick your language

View all programming interview questions

Need to run some C++ code first?

Online C++ Compiler

Reading answers is not the same as giving them. Sit a full mock interview and get scored on how you actually explain them.

Try a mock interview