Sample questions
Question 1Easy
What does 'pipeline as code' mean?
- Pipelines are configured only through a web UI
- Pipelines compile into binaries
- Each developer writes and runs their own pipeline locally, then uploads the results to the server
- Pipeline steps live in a versioned file in the repo
Answer: D. Pipeline steps live in a versioned file in the repo
Explanation
Files like a Jenkinsfile or workflow YAML are reviewed and versioned with the code.
Step-by-step solution
- Pipeline as code means pipelines are defined in files.
- These files are stored in a repository with the source code.
- The files are versioned, allowing tracking of changes.
- This makes collaboration and automation easier.
- Pipeline steps live in a versioned file in the repo.
Why the other options are wrong
- A. UI-only config is the opposite of pipeline as code; the definition lives outside version control.
- B. Pipelines run on a CI server, not compiled into binaries; a pipeline is a set of defined steps.
- C. Pipeline as code runs on the shared server from its repo file, not on each developer's laptop.
Tip: Use version control for pipelines to ensure transparency and repeatability.
Question 2Easy
Which is a typical CI pipeline stage order?
- Package → deploy → build → test
- Test → deploy → build → package
- Build → test → package → deploy
- Deploy → test → build → package
Answer: C. Build → test → package → deploy
Explanation
You compile, verify, produce an artifact, then deploy it.
Step-by-step solution
- A CI pipeline compiles the code first.
- Then it runs tests to check the build.
- It then packages an artifact and deploys it. Option C (build, test, package, deploy) is correct.
Why the other options are wrong
- A. Packaging comes after build and test, not before them.
- B. Deploying before building means there is nothing built to deploy.
- D. Deploying first puts untested code into production.
Tip: Build, then test, then package, then deploy is the usual CI order.
Question 3Easy
What typically triggers a CI pipeline?
- A user logging in to the app
- The CI server rebooting on a weekly schedule only
- A push or pull request to the repository
- A database backup finishing
Answer: C. A push or pull request to the repository
Explanation
Webhooks on commits and PRs start builds so every change is checked.
Step-by-step solution
- A CI pipeline runs automatically when repository events happen.
- A push to the repository or a pull request is the usual trigger, so each change gets checked.
- The correct answer is option C, a push or pull request to the repository.
Why the other options are wrong
- A. A user logging in to the app does not start a CI pipeline.
- B. A weekly schedule is only one option, not the usual trigger.
- D. A database backup finishing is not a normal CI trigger.
Tip: Commits and pull requests are the usual CI triggers.
Question 4Easy
Which is NOT usually a goal of CI/CD?
- Fast feedback on changes
- Repeatable, automated deployments
- Smaller, lower-risk releases
- Large, infrequent releases
Answer: D. Large, infrequent releases
Explanation
CI/CD aims for small, frequent, automated releases; big-bang releases are what it replaces.
Step-by-step solution
- CI/CD focuses on small changes to reduce risk.
- Automated processes ensure consistent deployments.
- Fast feedback helps catch issues early.
- Large releases are avoided for better control.
- So, large, infrequent releases are not a goal.
Why the other options are wrong
- A. Fast feedback is a core CI/CD goal, since failing builds are caught early.
- B. Repeatable, automated deployments are a core CI/CD goal, which removes manual steps.
- C. Smaller, lower-risk releases are a core CI/CD goal, since small changes are easier to roll back.
Tip: Remember: CI/CD replaces big-bang releases with frequent, automated ones.
Question 5Medium
Why put fast checks such as lint and unit tests early in a pipeline?
- To fail fast and give quick feedback
- Slow tests cannot run in CI
- They are more important than integration tests
- Linting must finish before code compiles in every language
Answer: A. To fail fast and give quick feedback
Explanation
Cheap checks catch most problems in minutes, saving time before expensive stages.
Step-by-step solution
- Fast checks like lint and unit tests find errors early.
- Early detection saves time on later, more complex steps.
- Quick feedback helps fix issues faster.
- This reduces overall development time and cost.
- Final answer: To fail fast and give quick feedback.
Why the other options are wrong
- B. Slow tests can run in CI; the point of ordering is to fail early, not to exclude slow tests.
- C. Unit tests are not more important than integration tests; both matter, and they run at different stages.
- D. Linting does not have to finish before compiling in every language; that is not a general rule.
Tip: Fail fast, save time.
Question 6Medium
Branch protection rules on main usually require:
- That only the repository owner can create pull requests
- Passing CI checks and reviews before merge
- Deleting the branch after each commit
- Force pushes to be allowed
Answer: B. Passing CI checks and reviews before merge
Explanation
Required checks stop broken or unreviewed code reaching the main branch.
Step-by-step solution
- Branch protection is a set of rules on the main branch.
- It typically requires CI checks to pass and a reviewer to approve before merge.
- Option B matches this: passing checks and reviews before merge.
Why the other options are wrong
- A. Protection rules govern merges to the branch, not who may open pull requests.
- C. Deleting branches after each commit is unrelated to protection.
- D. Protected branches normally block force pushes.
Tip: Protected main means required checks and reviews before any merge.
Question 7Medium
Why should CI runners use ephemeral, clean environments?
- It keeps old dependency caches and build outputs forever, so later builds can reuse them
- Clean runners never fail
- Ephemeral runners need no internet access
- Leftover state from earlier builds cannot affect results
Answer: D. Leftover state from earlier builds cannot affect results
Explanation
Fresh environments make builds reproducible and reduce the risk of one job tampering with another.
Step-by-step solution
- Ephemeral runners discard previous states after each build.
- Leftover files from earlier jobs can't influence new builds.
- This ensures consistent and reliable results every time.
Why the other options are wrong
- A. Keeping caches forever is not the point; ephemeral runners discard state, and caches are a separate, controlled feature.
- B. Clean runners can still fail for many reasons, such as bad code or flaky tests.
- C. Ephemeral runners still need internet access to pull code and dependencies; that is unrelated to cleanliness.
Tip: Use fresh environments to avoid build conflicts and ensure accuracy.
Question 8Medium
Feature flags help continuous delivery because:
- Unfinished features can ship turned off
- They speed up compilation by excluding the flagged code paths from the build entirely
- They make every deploy a rollback
- They remove the need for tests
Answer: A. Unfinished features can ship turned off
Explanation
Deploying code is separated from releasing features, so main stays deployable.
Step-by-step solution
- A feature flag wraps new code in a switch.
- The code can be deployed to production while the flag is off.
- So unfinished work ships without being visible to users. Option A is correct.
Why the other options are wrong
- B. Flags do not remove code from the build; the code still ships, just switched off.
- C. Flags reduce the need for rollbacks; they do not make every deploy a rollback.
- D. Flags do not replace tests.
Tip: Flags separate deploying code from releasing features, so main stays deployable.
Question 9Hard
A test fails randomly about 1 in 20 runs with no code change. What is the healthy response?
- Rerun the pipeline until it passes, since a pass shows the code is fine and the failure was noise
- Treat it as a flaky test: quarantine it and fix the root cause
- Delete all integration tests
- Lower the test coverage target
Answer: B. Treat it as a flaky test: quarantine it and fix the root cause
Explanation
Flaky tests erode trust in CI; tracking and fixing them keeps red builds meaningful.
Step-by-step solution
- A test that fails about 1 in 20 runs with no code change is flaky.
- Rerunning until it passes hides the problem and makes red builds meaningless.
- Quarantine the test so it stops blocking, then fix its root cause. Option B is the healthy response.
Why the other options are wrong
- A. Rerunning until green hides the flaw and treats a real signal as noise.
- C. Deleting integration tests removes coverage instead of fixing the flaky test.
- D. Lowering the coverage target does not address the flaky test.
Tip: A flaky test is a bug in the test: quarantine it, then fix the cause rather than rerunning or deleting.
Question 10Hard
Database schema changes in CD are safest when they are:
- Combined with large data rewrites in one step
- Backward compatible, so old and new app versions both work
- Done manually in production by a DBA after each deploy, so they can be checked line by line
- Applied after every Pod has been deleted
Answer: B. Backward compatible, so old and new app versions both work
Explanation
During a rollout both versions run; expand-then-contract changes avoid breaking the old version.
Step-by-step solution
- Backward compatibility ensures old and new apps work together.
- This prevents service disruption during schema changes.
- It allows for smooth transitions without data loss.
- Changes are tested with existing systems.
- Final answer: Backward compatible, so old and new app versions both work.
Why the other options are wrong
- A. Combining schema changes with big data rewrites in one step raises risk; keep them separate.
- C. Manual DBA changes after each deploy are not repeatable and bypass the automated pipeline.
- D. Deleting all Pods first causes downtime; schema changes must work with running old and new Pods.
Tip: Always prioritize backward compatibility for safe schema updates.
Practise all 21 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 →