CDM Continuous Integration & Continuous Delivery 2 — Questions and Answers
Question 1: Which branching strategy is most compatible with Continuous Integration because it minimizes long-lived feature branches?
- GitFlow
- Trunk-Based Development (Correct answer)
- Feature Branch Workflow
- Release Branch Strategy
Correct answer: Trunk-Based Development
Trunk-Based Development keeps all developers committing to a single mainline branch frequently, which is the ideal model for true CI.
Question 2: What is the primary purpose of a 'build artifact' produced during a CI pipeline?
- To document the code changes made in a commit
- To provide a deployable, versioned output that can be promoted through environments (Correct answer)
- To store test coverage reports for audit purposes
- To cache dependencies for faster future builds
Correct answer: To provide a deployable, versioned output that can be promoted through environments
A build artifact is an immutable, versioned package produced once and promoted through staging environments all the way to production.
Question 3: A CD pipeline deploys successfully to staging but fails in production due to environment-specific configuration. What practice best prevents this?
- Running more tests in staging
- Externalizing configuration and using environment variables injected at runtime (Correct answer)
- Rebuilding the artifact for each environment
- Disabling configuration validation in the pipeline
Correct answer: Externalizing configuration and using environment variables injected at runtime
Externalizing configuration (e.g., via environment variables or a config service) ensures the same artifact runs identically across all environments.
Question 4: What does 'shift-left testing' mean in the context of a CI/CD pipeline?
- Moving production deployments to the left side of the Kanban board
- Introducing testing earlier in the development lifecycle to catch defects sooner (Correct answer)
- Running integration tests before unit tests in the pipeline
- Delegating testing responsibilities to the operations team
Correct answer: Introducing testing earlier in the development lifecycle to catch defects sooner
Shift-left testing means moving quality checks earlier in the pipeline (toward development) so defects are caught when they are cheapest to fix.
Question 5: Which metric directly measures the speed of a CI/CD pipeline from code commit to production deployment?
- Change Failure Rate
- Mean Time to Recovery (MTTR)
- Lead Time for Changes (Correct answer)
- Deployment Frequency
Correct answer: Lead Time for Changes
Lead Time for Changes measures the elapsed time from when a code commit is made until it reaches production, directly reflecting pipeline speed.
Question 6: What is the role of a 'quality gate' in a CI pipeline?
- A manual approval step before every deployment
- An automated check that stops the pipeline if defined quality thresholds are not met (Correct answer)
- A performance test run only in production
- A code review process conducted by senior engineers
Correct answer: An automated check that stops the pipeline if defined quality thresholds are not met
A quality gate is an automated policy that blocks pipeline progression if metrics like code coverage or static analysis scores fall below defined thresholds.
Question 7: In a CI/CD context, what is 'pipeline as code'?
- Writing application code that directly manages server infrastructure
- Defining pipeline stages and steps in version-controlled configuration files (Correct answer)
- Generating pipeline stages dynamically using machine learning
- Storing pipeline execution logs in the application repository
Correct answer: Defining pipeline stages and steps in version-controlled configuration files
Pipeline as code means defining CI/CD pipelines in files (e.g., Jenkinsfile, .gitlab-ci.yml) stored in version control, enabling versioning and peer review of pipeline logic.
Which branching strategy is most compatible with Continuous Integration because it minimizes long-lived feature branches?