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.

208 Qs
21 Moderate Smart pointers C++

unique_ptr versus shared_ptr?

Short take

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
22 Moderate Smart pointers C++

When do you need weak_ptr?

Short take

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
23 Moderate Move C++

What are move semantics?

Short take

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
24 Moderate Templates C++

What is a function template?

Short take

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
25 Moderate OOP C++

What is the diamond problem?

Short take

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
26 Moderate OOP C++

What is a vtable?

Short take

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
28 Moderate Language C++

What is a lambda in C++?

Short take

Simple meaning

An anonymous function object.

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

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

What is exception safety?

Short take

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
31 High Templates C++

What is SFINAE?

Short take

Simple meaning

Substitution failure is not an error: a bad template candidate is dropped instead of failing the whole program.

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

Read full answer Example · Mistake · Say this
32 High Concurrency C++

What is a data race?

Short take

Simple meaning

Two threads access the same memory, at least one writes, with no happens-before.

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

Read full answer Example · Mistake · Say this
33 High Language C++

What is the one-definition rule?

Short take

Simple meaning

A function or variable can be defined only once in the program, with exceptions for inline and templates.

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

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

What is a virtual function?

Short take

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
Prev Page 2 of 11 Next
Chat with us