C++ track

C++ interview questions and answers

Panel-ready C++ interview set questions for freshers and experienced developers. Practice at Coding Cadre in Faridabad, or Online from Delhi NCR.

1 Moderate Rule of Five C++

What is the rule of three or five?

Short take Full answer on next page

Simple meaning

If I write a destructor, copy constructor, or copy assignment, I likely need all three.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
2 Moderate RAII C++

What is RAII?

Short take Full answer on next page

Simple meaning

Resource acquisition is initialization: the constructor takes the resource, the destructor releases it.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
3 Moderate Smart pointers C++

unique_ptr versus shared_ptr?

Short take Full answer on next page

Simple meaning

Unique_ptr is exclusive ownership, zero overhead, move-only.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
4 Moderate Smart pointers C++

When do you need weak_ptr?

Short take Full answer on next page

Simple meaning

To break shared_ptr cycles, like parent-child observers.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
5 Moderate Move C++

What are move semantics?

Short take Full answer on next page

Simple meaning

A move constructor steals resources from an rvalue so we copy pointers, not buffers.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
6 Moderate Templates C++

What is a function template?

Short take Full answer on next page

Simple meaning

The compiler generates a function per type I call it with.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
7 Moderate OOP C++

What is the diamond problem?

Short take Full answer on next page

Simple meaning

Two bases share a grand-base, so a derived object would get two copies of the grand-base.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
8 Moderate OOP C++

What is a vtable?

Short take Full answer on next page

Simple meaning

A per-class table of function pointers for virtual methods.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
10 Moderate Language C++

What is a lambda in C++?

Short take Full answer on next page

Simple meaning

An anonymous function object.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
11 Moderate Exceptions C++

What is exception safety?

Short take Full answer on next page

Simple meaning

The basic guarantee leaves the program valid

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
12 Moderate OOP C++

What is a virtual function?

Short take Full answer on next page

Simple meaning

Virtual enables dynamic dispatch so a base pointer can call the derived override.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
13 Moderate Memory C++

What are smart pointers and why use them?

Short take Full answer on next page

Simple meaning

unique_ptr and shared_ptr manage lifetime automatically so I rarely call delete.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
14 Moderate Basics C++

What does const correctness mean?

Short take Full answer on next page

Simple meaning

I mark methods and params const when they should not modify state.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
17 Moderate Modern C++

What does std::move do?

Short take Full answer on next page

Simple meaning

It casts to an rvalue so move constructors can steal resources.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
Page 1 of 5 Next
Chat with us