INTERVIEW PREP
Interview questions
570 questions from real DevOps, SRE, platform engineering and MLOps interviews, with the answer an interviewer wants to hear. Try answering out loud first, then open the model answer.
Showing 1–8 of 8 questions
Learn Python for DevOps →1.Why is shell=True dangerous in subprocess?Mid
The text is parsed by a shell, so special characters from outside input can run extra commands. Pass the command as a list of arguments instead.
2.How do you call a REST API safely from Python?Mid
Use requests with a timeout, call raise_for_status(), keep tokens in environment variables, handle paging, and retry on 429 and 5xx.
3.What is yaml.safe_load and why prefer it?Mid
It parses YAML into plain data only. The unsafe loader can create arbitrary Python objects, so a crafted file could run code.
4.What does idempotent mean for an automation script?Mid
Running it again gives the same end result and causes no harm. Check what exists first, then create, update or skip.
5.Why use logging instead of print?Mid
Logging gives timestamps and levels, can write to files, and can be turned up or down without changing code.
6.What is exponential backoff?Mid
Waiting longer after each failed try, such as 1s, 2s, 4s. It gives a busy service time to recover. Always cap the number of tries.
7.How do you test code that calls AWS?Mid
Mock the client in unit tests or use moto to fake AWS. Keep real-cloud tests few, slow and separate.
8.What does a --dry-run flag do, and why add it?Mid
It shows what the tool would change without changing anything. People can check the result first, so a mistake costs nothing.