InterviewStack.io LogoInterviewStack.io

Language-Level Memory Management (C/C++/Rust) Questions

How specific languages expose and manage memory: pointers and references, pointer arithmetic, stack versus heap allocation, ownership and borrowing in Rust, RAII and smart pointers in C++, manual allocation and freeing in C, and garbage-collection semantics as a language feature. Covers reasoning about ownership, lifetimes, leaks, and dangling references at the language level. OS-level virtual memory and paging internals live in Operating Systems & Systems Programming.

MediumTechnical
62 practiced

A multithreaded worker becomes slower as you add more CPU cores, even though each thread mostly updates its own counter inside a shared status object. How would you investigate the slowdown, and what low-level effects might explain it?

MediumTechnical
78 practiced

A request-handling thread needs to read and update a small shared state object on every request. A mutex keeps the code simple, but latency is too high under load. How would you decide whether to keep the lock, change the data layout, or use a different synchronization strategy?

HardTechnical
67 practiced

A production C service occasionally corrupts heap memory after handling a few large requests, but you cannot reproduce it with a single test case. How would you narrow down the source of the corruption and what would you instrument first to catch it in the act?

MediumTechnical
62 practiced

Write a C function that removes every node with a target value from a singly linked list and returns the new head. The implementation should free removed nodes correctly and handle deleting the first node without special-case bugs.

EasyTechnical
132 practiced

A C function in a service occasionally crashes when a caller uses the pointer it returns, but only after the function has finished executing. How would you debug this, and what would you look for in the code and runtime behavior to confirm the root cause?

Unlock Full Question Bank

Get access to all 20 Language-Level Memory Management (C/C++/Rust) interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.