Skip to content
$ lynuxpro

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 46–60 of 229 questions

46.How do you call a REST API safely from Python?MidPython for DevOps

Use requests with a timeout, call raise_for_status(), keep tokens in environment variables, handle paging, and retry on 429 and 5xx.

47.What is yaml.safe_load and why prefer it?MidPython for DevOps

It parses YAML into plain data only. The unsafe loader can create arbitrary Python objects, so a crafted file could run code.

48.What does idempotent mean for an automation script?MidPython for DevOps

Running it again gives the same end result and causes no harm. Check what exists first, then create, update or skip.

49.Why use logging instead of print?MidPython for DevOps

Logging gives timestamps and levels, can write to files, and can be turned up or down without changing code.

50.What is exponential backoff?MidPython for DevOps

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.

51.How do you test code that calls AWS?MidPython for DevOps

Mock the client in unit tests or use moto to fake AWS. Keep real-cloud tests few, slow and separate.

52.What is a paginator in boto3?SeniorPython for DevOps

A helper that follows the page tokens of an AWS API for you, so you get every result rather than only the first page.

53.How should a Python script get AWS credentials in production?SeniorPython for DevOps

From an IAM role attached to the compute (EC2, ECS, Lambda or an EKS service account). No long-lived keys in code or files.

54.load_kube_config or load_incluster_config?SeniorPython for DevOps

load_kube_config reads your local kubeconfig and suits laptops. load_incluster_config uses the pod's service account and suits code running in the cluster.

55.Threads, asyncio or processes?SeniorPython for DevOps

Threads for a moderate number of I/O waits, asyncio for very many connections with async libraries, processes for CPU-heavy work. Always limit concurrency.

56.How do you share an internal Python tool?SeniorPython for DevOps

Describe it in pyproject.toml with a script entry point, build with python -m build, publish to a private index, and install with pipx or pip.

57.What does a Kubernetes operator do?SeniorPython for DevOps

It watches a custom resource and runs a reconcile loop to make the real state match the wanted state. With kopf you write handlers for create, update and delete.

58.What makes an operator handler well written?SeniorPython for DevOps

It is idempotent, sets owner references on child objects, writes status, cleans up on delete, and runs with least-privilege RBAC.

59.What do FastAPI and pydantic give you?SeniorPython for DevOps

Typed request models with automatic validation (422 on bad input), generated interactive docs, and clear dependency injection for things like authentication.

60.How do you keep Python code quality high across many teams?SeniorPython for DevOps

Type hints with mypy, ruff for lint and format, pytest with coverage, pre-commit hooks, the same checks in CI as a required gate, dependency audits, and shared project templates.