KatInterview

Git, Docker, Python Environments and Modern C++ Essentials

System DesignModel answer
MediumModel answerSystem Designgitdockerpython

Last updated

Explain a team Git workflow, Docker image practices, Python isolation and pinning, and core C++ idioms (RAII, moves, const), with reasons and trade-offs.

You are in a broad technical discussion about everyday engineering practice. Answer the four parts below, giving the reasoning behind each rule of thumb and not just a list of commands or definitions.

  1. Git collaboration. Walk through how you would take a change from idea to merged code using a topic branch and a pull request. Say when you would rebase and when you would merge, and why.
  2. Docker. Explain the difference between an image, a container and a Dockerfile. Describe how you would make an image smaller and how you would keep credentials out of it.
  3. Python environments. Compare a virtual environment with a container as isolation mechanisms. Explain how you would pin dependencies for an application versus a reusable library.
  4. C++ idioms. Explain RAII, move semantics and const-correctness, with a short code example for each idea.

State any assumptions, call out common pitfalls, and say how you would check that your approach works in practice.

Hints

Hint 1

For Git, think about who else might hold copies of the commits you are about to rewrite. That decides rebase versus merge.

Hint 2

Docker layers are additive: deleting a file in a later layer does not shrink the earlier layer. Also ask where a secret could leak (layers, history, environment).

Hint 3

For pinning, separate what you intend to depend on (ranges) from what actually got installed (a full lock with hashes). Applications and libraries need different strategies.

Hint 4

In C++, ask what happens to a resource when an exception is thrown halfway through a function, and what a move leaves behind in the source object.