Is Coding Asked in DevOps Interviews?
Yes, most DevOps and SRE interviews include coding, but the coding is usually practical rather than algorithmic. The most common task is a short program that reads text and produces a result: parse a web server log, count status codes, build a small command-line tool, or work out how many requests a rate limiter would drop. Many large companies also add one easy or medium algorithm problem, while some enterprise interviews include little or no coding.
The rest of this answer explains which kinds of coding appear, how they are judged, and how to prepare.
What Coding Rounds Ask For
Candidate reports describe three kinds of coding question in these loops.
| Kind | Typical question | Where candidates report it |
|---|---|---|
| Practical parsing | Count HTTP status codes and the top paths in an access log, then handle a changed field order | Production engineer and SRE screens at large product companies |
| Small tools | Build a grep style command-line tool, or a simplified tail -n, with standard library modules only | SRE and production engineer onsites |
| Algorithms | An easy or medium array, string, or hash map problem | Large companies, especially on software-heavy SRE tracks |
A fourth kind appears less often: reading a long function and splitting it into smaller ones without changing its behavior. Some SRE tracks at very large companies run a coding loop close to a normal software engineering loop, while some bank and enterprise DevOps interviews ask mostly about tools and daily work instead.
Which Language to Use
Python is the safest choice for most candidates. It has the text handling, collections.Counter, defaultdict, deque, re, csv, and json that these tasks need, and interviewers can read it easily. Bash is fine for a short pipeline such as awk '{print $9}' access.log | sort | uniq -c | sort -rn, but it becomes hard to follow when the task grows. Go is accepted by many companies if it is the language you write fastest.
Confirm the language and the editor with the recruiter. Some interviews run in a shared document with no autocomplete, and some block outside libraries.
How the Round Is Judged
Interviewers watch how you work, not only whether the final output is right.
- You clarify the input first. Ask what a line looks like, whether lines can be malformed, and how large the file is.
- You handle bad lines. A real log has truncated and unexpected lines. Skip them and count how many you skipped.
- You stream large files. Reading a 40 GB log into memory fails. Process one line at a time, or read blocks from the end for
tail. - You test small cases. Run the code on three or four lines you wrote yourself, including an empty input.
- You state the cost. Say how the time and memory grow with the size of the input.
- You talk while you code. A short sentence before each step lets the interviewer follow your reasoning and help when you are stuck.
Follow-up questions usually change the input. The field order changes, a second log format appears, or the file is too large for memory. Code that separates parsing from counting is easier to change under those questions.
How to Prepare
- Write a log parser, a grep style tool, a
tail -nthat reads from the end, and a rate limiter counter, each from a blank file, in under 30 minutes. - Practice the standard library modules listed above until you do not need to look them up.
- Solve 20 to 30 easy and medium array, string, and hash map problems if your target companies ask algorithm questions.
- Learn enough Bash to read and write a five-stage pipeline, and know when to switch to Python.
- Do each exercise out loud once, as you would in the interview.
Grokking DevOps and SRE Interviews has a coding and scripting chapter with these four exercises as runnable Python programs that check their own results, plus a lesson on Bash for interviews. For algorithm practice, Grokking the Coding Interview teaches the patterns behind easy and medium problems.
Key Points
- Most DevOps and SRE loops include coding, usually practical text processing rather than hard algorithms.
- Python is the safest language, with Bash for short pipelines.
- Interviewers judge clarifying questions, handling bad input, memory use, testing, and explanation.
- Expect follow-up questions that change the input, and write code that is easy to change.

GET YOUR FREE
Coding Questions Catalog

$98

$98

$197