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 16–30 of 129 questions
16.What is the difference between the working directory, the staging area and a commit?BeginnerGit
The working directory is your files as they are now. git add copies changes to the staging area (the index), which is what the next commit will contain. git commit saves the staged snapshot into history.
17.What does .gitignore do, and why doesn't it ignore a file I already committed?BeginnerGit
It tells Git which untracked files to leave out, like node_modules/ or .env. Files that are already tracked keep being tracked; remove them from the index with git rm --cached file, then commit.
18.What is the difference between git reset, git revert and git restore?BeginnerGit
git restore throws away changes in files. git reset moves your branch back to an earlier commit (rewrites local history). git revert makes a new commit that undoes an old one, which is safe on shared branches.
19.What is a pull request (merge request), and why use one?BeginnerGit
It is a request to merge one branch into another, with a place to review the diff, discuss it and run CI. It adds a quality gate and a record of why a change was made.
20.Why use a virtual environment?BeginnerPython for DevOps
It gives each project its own Python packages, so versions never clash between projects and your system Python stays clean.
21.What is the difference between a list and a dict?BeginnerPython for DevOps
A list is an ordered group of items you reach by position. A dict stores values under names (keys), so you reach them by key.
22.How do you read a file safely?BeginnerPython for DevOps
Use a with block: with open(path) as f. It closes the file even when an error happens. pathlib makes paths work on every system.
23.What does exit code 0 mean?BeginnerPython for DevOps
Success. Any other number means failure. CI systems and shells read this number, so scripts should exit non-zero when they fail.
24.What is the difference between a function and a module?BeginnerPython for DevOps
A function is a named block of steps you can call again and again. A module is a .py file that holds functions and other code, so you can import and share them.
25.What happens when you run mvn package?BeginnerMaven & Build Tools
Maven runs every lifecycle phase up to package in order: validate, compile, test, then package. Each phase runs the plugin goals bound to it, producing the jar in target/.
26.What are dependency scopes?BeginnerMaven & Build Tools
compile (default, everywhere), provided (compile only, the runtime supplies it), runtime (not for compiling), test (tests only), and system/import. Scope controls the classpath and whether the dependency is packaged.
27.What is a POM file?BeginnerMaven & Build Tools
pom.xml describes a Maven project: its coordinates (groupId, artifactId, version), dependencies, plugins, packaging and build settings. Maven reads it to know what to download and how to build.
28.What are Maven coordinates?BeginnerMaven & Build Tools
groupId:artifactId:version (plus packaging and classifier) uniquely names an artifact, for example org.springframework:spring-core:6.1.2. Repositories store artifacts by these coordinates.
29.What are the main phases of the Maven lifecycle?BeginnerMaven & Build Tools
validate, compile, test, package, verify, install and deploy. Running a phase runs every phase before it, so mvn install also compiles, tests and packages.
30.What is the difference between mvn install and mvn deploy?BeginnerMaven & Build Tools
install copies the built artifact into your local repository (~/.m2) so other local projects can use it. deploy uploads it to a remote repository like Artifactory or Nexus for everyone.