CI/CD Questions with Answers

7 practice questions on CI/CD (Git & DevOps) with answers and step-by-step solutions. Try 7 samples below, then practise all 7 free in the AptiNest app.

Sample questions

Question 1Easy

Which of these most commonly triggers a CI pipeline?

  1. A push or a pull request to the repository
  2. Opening the IDE
  3. A developer logging in
  4. Changing the README locally without committing

Answer: A. A push or a pull request to the repository

Explanation

CI systems listen for repository events such as pushes, pull requests and tags (and can also run on a schedule).

Step-by-step solution

  1. CI systems listen for repository events.
  2. Pushes and pull requests are the most common triggers.
  3. Schedules and tags can also trigger runs.

Why the other options are wrong

  • B. Opening an IDE is local.
  • C. Logging in is not a repository event.
  • D. Uncommitted local changes are invisible to CI.

Tip: No commit pushed, no CI run.

Question 2Easy

Where should a CI pipeline get an API key it needs during deployment?

  1. Hard-coded in the source code so every build can find it
  2. From a commit message written by the person deploying
  3. From the project README so the team can see it easily
  4. From the CI system's encrypted secrets, as an env variable

Answer: D. From the CI system's encrypted secrets, as an env variable

Explanation

Secrets must never be committed. CI platforms provide encrypted secrets that are injected at runtime and masked in logs.

Step-by-step solution

  1. Secrets must never be committed.
  2. CI platforms store them encrypted.
  3. They are injected at run time as environment variables and masked in logs.

Why the other options are wrong

  • A. Hard-coded keys leak to anyone with code access.
  • B. Commit messages are permanent and visible.
  • C. The README is public to everyone with the repo.

Tip: Keys go in the CI secret store, never in the repo.

Question 3Easy

What is Continuous Integration (CI)?

  1. Writing code first and adding tests at the end of the project
  2. Integrating several databases into a single shared instance
  3. Frequently merging changes, each automatically built and tested
  4. Deploying to production on a fixed monthly release schedule

Answer: C. Frequently merging changes, each automatically built and tested

Explanation

CI catches integration problems early by running automated builds and tests on every push or pull request.

Step-by-step solution

  1. Developers merge changes into the shared branch often.
  2. Each change triggers an automatic build and tests.
  3. Problems are found early, while they are small.

Why the other options are wrong

  • A. Testing at the end is the opposite of CI.
  • B. CI is unrelated to databases.
  • D. Fixed monthly releases are not CI.

Tip: CI = merge often, test automatically.

Question 4Medium

What is the difference between Continuous Delivery and Continuous Deployment?

  1. They are the same practice, just described using two different names
  2. Delivery needs a manual release step; Deployment releases automatically
  3. Delivery is the term for mobile apps, while Deployment is used for web apps
  4. Deployment skips the automated test stage so that changes reach users faster

Answer: B. Delivery needs a manual release step; Deployment releases automatically

Explanation

Both automate building and testing. The difference is whether the final step to production is automatic.

Step-by-step solution

  1. Both automate build and test.
  2. Continuous Delivery keeps every change releasable, with a manual approval to release.
  3. Continuous Deployment releases every passing change automatically.

Why the other options are wrong

  • A. They differ in the final release step.
  • C. Neither is tied to mobile or web.
  • D. Deployment still runs all automated tests.

Tip: Delivery: ready. Deployment: released.

Question 5Medium

What is a blue-green deployment?

  1. Deploying only on weekdays, never on weekends or holidays
  2. A deployment that uses two different programming languages
  3. Two identical environments; traffic switches from old to new at once
  4. Testing the release in a staging environment instead of production

Answer: C. Two identical environments; traffic switches from old to new at once

Explanation

Switching traffic between two complete environments gives near-zero downtime and an instant rollback path.

Step-by-step solution

  1. Keep two identical environments: blue (live) and green (new).
  2. Deploy and test the new version on green.
  3. Switch all traffic to green at once; switch back if needed.

Why the other options are wrong

  • A. Unrelated to days of the week.
  • B. Unrelated to programming languages.
  • D. Staging tests happen before deployment; blue-green is about switching production.

Tip: Blue-green: switch all at once; canary: switch a few first.

Question 6Hard

What is a canary release?

  1. Releasing without any monitoring to keep the rollout simple
  2. Releasing only to internal testers and never to real users
  3. Rolling out to a small share of users first, then expanding
  4. Releasing the new version to every user at the same moment

Answer: C. Rolling out to a small share of users first, then expanding

Explanation

Exposing a change to a small group first limits the damage if something goes wrong.

Step-by-step solution

  1. Release the new version to a small share of users.
  2. Watch error rates and metrics.
  3. Expand gradually if healthy; roll back if not.

Why the other options are wrong

  • A. Canary releases depend on monitoring.
  • B. Canaries go to real users.
  • D. All at once is a big-bang release.

Tip: Canary = small slice first.

Question 7Hard

Why do many pipelines build the artifact (for example a Docker image) once and promote that same artifact through staging to production?

  1. So the exact artifact tested in staging is what runs in production
  2. To save disk space on the build server by keeping fewer images
  3. So that testing can be skipped in the production environment
  4. Because container images technically cannot be rebuilt again

Answer: A. So the exact artifact tested in staging is what runs in production

Explanation

Rebuilding for each environment can pull in different dependency versions. Promoting one immutable artifact keeps what you tested identical to what you release.

Step-by-step solution

  1. Build the artifact once.
  2. Test that exact artifact in staging.
  3. Promote the same artifact to production, so what you tested is what you run.

Why the other options are wrong

  • B. Saving disk space is a minor side effect.
  • C. Production still needs monitoring and checks.
  • D. Images can be rebuilt; the point is not to.

Tip: Build once, deploy many.

Practise all 7 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all Git & DevOps topics · All topics