Back to sections

CI/CD Quiz

Test what you actually know about CI/CD. Free sample questions below, from easy to hard, with instant explanations.

easy

1. What does it mean for a CI/CD pipeline to be defined as "pipeline as code"?

The pipeline can only be triggered by code commits, never manually
The pipeline's configuration (stages, jobs, steps) is written in a file and stored in version control alongside the application codeCorrect
The pipeline automatically generates its own application source code
The pipeline runs exclusively on code written in the same language as the application

Pipeline as code means the pipeline definition itself, such as a .gitlab-ci.yml, Jenkinsfile, or GitHub Actions workflow file, lives in a version-controlled file rather than being configured by clicking through a UI. This gives the pipeline the same benefits as application code: change history, review via pull requests, and easy rollback of pipeline changes. It has nothing to do with the pipeline writing application source code, and it doesn't restrict how the pipeline can be triggered.

medium

2. What is blue-green deployment?

A testing framework
Color-coded logs
Running two identical production environments for zero-downtime deploysCorrect
A monitoring dashboard

Blue-green deployment keeps two full, identical production environments running side by side, one live (blue) and one idle with the new version (green). Switching traffic from blue to green happens instantly, so there's no downtime, and if anything goes wrong you can just switch back to blue just as fast.

hard

3. What is trunk-based development?

Working on tree diagrams
Long-lived feature branches
A branching model where developers integrate small changes frequently to mainCorrect
Avoiding version control

Trunk-based development means everyone merges small changes into the main branch constantly instead of working for weeks on a separate feature branch. Frequent small merges are much easier to integrate cleanly than one giant merge at the end, which is exactly the conflict-heavy scenario long-lived branches create.

easy

4. In GitHub Actions, where are workflows defined?

.gitlab-ci.yml
Jenkinsfile
ci.yaml in root
.github/workflows/ directory as YAML filesCorrect

GitHub looks for workflow definitions in one specific spot: the .github/workflows/ folder, written as YAML files. That's different from how Jenkins (a Jenkinsfile) or GitLab (.gitlab-ci.yml) each expect their own pipeline config to live.

medium

5. What is the purpose of automated testing in CI?

To replace developers
To catch bugs early before they reach productionCorrect
To increase code size
To slow down deployments

Running automated tests on every single change means a bug gets flagged the moment it's introduced, while it's still fresh and easy to trace, rather than being discovered days or weeks later once it's already reached production and affected real users.

hard

6. Your CI pipeline caches dependencies between builds to speed things up, but occasionally a build succeeds using a stale cached dependency that doesn't match the lockfile - a mismatch that only ever happens in CI, never locally. What's the most likely cause?

The CI runner has a different CPU architecture
The cache key isn't derived from the lockfile's hash, so an updated lockfile doesn't invalidate the old cacheCorrect
The pipeline doesn't have internet access
Local development doesn't use a lockfile at all

A cache is only useful if it gets thrown out when the thing it's caching changes. If the cache key doesn't include a hash of the lockfile, updating the lockfile doesn't tell the cache anything changed, so CI keeps reusing the old, now-outdated dependencies instead of installing the ones the lockfile actually specifies.

easy

7. Which file defines a pipeline in GitLab CI?

gitlab.yml
pipeline.yml
ci-config.yml
.gitlab-ci.ymlCorrect

GitLab looks for one specific file at the root of your repo, .gitlab-ci.yml, and that's what tells its Runners which jobs and stages to execute. Other names like pipeline.yml or gitlab.yml simply won't be recognized.

medium

8. Which command installs dependencies in a Node.js GitHub Actions job?

npm run build
npm installCorrect
npm publish
npm start

Before your code can be built or tested, all the packages it depends on need to actually be present, and npm install is the command that reads package.json and downloads exactly those packages, which is why it's the very first step in a Node.js job.

hard

9. An application currently runs on a single small production environment, and the infrastructure budget doesn't allow provisioning a second full-sized parallel environment. The team still wants to reduce the risk of a bad deploy by rolling changes out gradually rather than all at once. Which deployment strategy best fits these constraints?

Shadow deployment: mirror live production traffic to a fully separate parallel environment for testing without affecting users
Rolling deployment: gradually replace old instances with new ones a few at a time within the existing capacityCorrect
Big-bang deployment: deploy the new version to every instance simultaneously
Blue-green deployment: run two complete, identical production environments and switch traffic between them

A rolling deployment replaces instances incrementally within the same pool of servers, so it needs only a little spare capacity, or even none if done one instance at a time, rather than a whole second environment. Blue-green and shadow deployments both require standing up a full duplicate environment, which is exactly what the limited budget here rules out. Big-bang deployment offers no gradual risk reduction at all, since every instance changes at once.

easy

10. What is the main benefit of CI/CD?

Better graphics
Cheaper servers
Reduced coding
Faster and more reliable software deliveryCorrect

By automating the repetitive parts (building, testing, releasing), CI/CD removes a lot of room for human error and shortens the time between writing code and finding out if it works, which is why teams end up shipping faster and with more confidence.

Ready for the real thing?

Take the full timed CI/CD quiz and see your score.

    Welcome to OpsQuiz!

    Real scenario-based DevOps questions, hands-on practice, and clear explanations for every answer.