DevOps MCQ questions
Take a short practice test with instant feedback, then revise every question with its answer and the reason behind it.
- Questions
- 50
- From lessons
- 30
- Your last test
- —
Practice test
What does “build once, deploy many” mean?
All questions with answers
Which command creates a local copy of a remote repository?
Show answer
Answer: B. git clone
clone copies the repository with its full history.
Which command stages changes for the next commit?
Show answer
Answer: B. git add
git add moves changes into the index.
Which command shows changed and staged files?
Show answer
Answer: B. git status
git status summarises the working tree and index.
Which command uploads local commits to the remote?
Show answer
Answer: B. git push
push sends commits; fetch downloads them.
Which practice integrates code to the main branch several times a day with automated builds?
Show answer
Answer: A. Continuous integration
CI catches integration problems early.
Where do GitHub Actions workflows live?
Show answer
Answer: B. .github/workflows
Each YAML file in .github/workflows is a workflow.
Which keyword makes a job wait for another job?
Show answer
Answer: C. needs
needs: build runs the job after build succeeds.
Which Dockerfile instruction sets the command a container runs?
Show answer
Answer: B. CMD / ENTRYPOINT
RUN executes at build time; CMD and ENTRYPOINT at container start.
What does a multi-stage build reduce?
Show answer
Answer: B. Final image size and attack surface
Build tools stay in earlier stages and are not shipped.
Which command lists running containers?
Show answer
Answer: B. docker ps
docker ps -a also shows stopped containers.
Which file defines multi-container apps for Docker Compose?
Show answer
Answer: B. compose.yaml
docker compose up starts all the services it defines.
What is the smallest deployable unit in Kubernetes?
Show answer
Answer: B. Pod
A Pod wraps one or more containers that share network and storage.
Which Kubernetes object gives Pods a stable network address?
Show answer
Answer: B. Service
Services load-balance across matching Pods.
Which command shows a Terraform execution plan without changing anything?
Show answer
Answer: B. terraform plan
Review the plan, then apply it.
Which strategy sends a small percentage of traffic to a new version first?
Show answer
Answer: B. Canary
Canary releases expand gradually while metrics stay healthy.
Where should pipeline secrets be stored?
Show answer
Answer: C. In the platform’s secret store or a vault
Secrets are injected at runtime and masked in logs.
What is wrong with this workflow step?
YAML Illustrative - run: curl -H "Authorization: Bearer ghp_EXAMPLE_NOT_A_REAL_TOKEN" https://deploy.example.com/releaseShow answer
Answer: B. The token is hard-coded in the repository
Use ${{ secrets.DEPLOY_TOKEN }} and rotate the exposed token immediately.
Which kind of scan finds known vulnerabilities in dependencies?
Show answer
Answer: B. SCA (software composition analysis)
Dependabot and npm audit are SCA tools.
What does git rebase main do on a feature branch?
Show answer
Answer: B. Replays the branch’s commits on top of main
It rewrites the branch’s commit hashes, so avoid it on shared branches.
Which metric shows how often a team deploys to production?
Show answer
Answer: B. Deployment frequency
It is one of the four DORA metrics.
What is the relationship between an image and a container?
Show answer
Answer: B. A container is a running instance of an image
Images are templates; containers are running (or stopped) instances.
From the lesson: DockerWhich is NOT one of the four DORA metrics?
Show answer
Answer: B. Lines of code written
Lines of code is not a DORA metric.
From the lesson: Introduction to DevOpsWhat does “shift left” mean?
Show answer
Answer: B. Test and check security earlier in the lifecycle
Earlier checks catch problems when they are cheap to fix.
From the lesson: Software Development LifecycleWhich command moves changes into the staging area?
Show answer
What does git push -u origin main do the first time?
Show answer
Answer: B. Pushes main and sets it to track origin/main
-u sets the upstream branch.
From the lesson: GitHub